Fix when connect to socket happens
This commit is contained in:
parent
e8e52b82a1
commit
5f435b488a
1 changed files with 7 additions and 6 deletions
|
@ -35,6 +35,13 @@ var RootCmd = &cobra.Command{
|
||||||
Use: "signald-cli",
|
Use: "signald-cli",
|
||||||
Short: "Interact with a running siangld instance",
|
Short: "Interact with a running siangld instance",
|
||||||
Long: `signald-cli is a command line tool to interact with signald.`,
|
Long: `signald-cli is a command line tool to interact with signald.`,
|
||||||
|
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
||||||
|
s = &signald.Signald{SocketPath: socketPath}
|
||||||
|
err := s.Connect()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute adds all child commands to the root command sets flags appropriately.
|
// Execute adds all child commands to the root command sets flags appropriately.
|
||||||
|
@ -50,12 +57,6 @@ func init() {
|
||||||
cobra.OnInitialize(initConfig)
|
cobra.OnInitialize(initConfig)
|
||||||
RootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.signald-cli.yaml)")
|
RootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.signald-cli.yaml)")
|
||||||
RootCmd.PersistentFlags().StringVarP(&socketPath, "socket", "s", "/var/run/signald/signald.sock", "the path to the signald socket file")
|
RootCmd.PersistentFlags().StringVarP(&socketPath, "socket", "s", "/var/run/signald/signald.sock", "the path to the signald socket file")
|
||||||
s = &signald.Signald{SocketPath: socketPath}
|
|
||||||
err := s.Connect()
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// initConfig reads in config file and ENV variables if set.
|
// initConfig reads in config file and ENV variables if set.
|
||||||
|
|
Loading…
Reference in a new issue