more gofmt
This commit is contained in:
parent
c69745b52b
commit
110afc7e8b
2 changed files with 8 additions and 8 deletions
|
@ -32,15 +32,15 @@ var listGroupsCmd = &cobra.Command{
|
|||
Run: func(cmd *cobra.Command, args []string) {
|
||||
requestID := fmt.Sprint("signald-cli-", rand.Intn(1000))
|
||||
s.SendRequest(signald.Request{
|
||||
Type: "list_groups",
|
||||
Username: username,
|
||||
ID: requestID,
|
||||
Type: "list_groups",
|
||||
Username: username,
|
||||
ID: requestID,
|
||||
})
|
||||
|
||||
c := make(chan signald.Response)
|
||||
go s.Listen(c)
|
||||
for {
|
||||
message := <- c
|
||||
message := <-c
|
||||
if message.ID == requestID {
|
||||
for _, group := range message.Data.Groups {
|
||||
fmt.Println(group.Name)
|
||||
|
|
|
@ -33,7 +33,7 @@ var s *signald.Signald
|
|||
var RootCmd = &cobra.Command{
|
||||
Use: "signald-cli",
|
||||
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.`,
|
||||
}
|
||||
|
||||
// Execute adds all child commands to the root command sets flags appropriately.
|
||||
|
@ -49,7 +49,7 @@ func init() {
|
|||
cobra.OnInitialize(initConfig)
|
||||
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")
|
||||
s = &signald.Signald{SocketPath: socketPath,}
|
||||
s = &signald.Signald{SocketPath: socketPath}
|
||||
s.Connect()
|
||||
}
|
||||
|
||||
|
@ -60,8 +60,8 @@ func initConfig() {
|
|||
}
|
||||
|
||||
viper.SetConfigName(".signald-cli") // name of config file (without extension)
|
||||
viper.AddConfigPath("$HOME") // adding home directory as first search path
|
||||
viper.AutomaticEnv() // read in environment variables that match
|
||||
viper.AddConfigPath("$HOME") // adding home directory as first search path
|
||||
viper.AutomaticEnv() // read in environment variables that match
|
||||
|
||||
// If a config file is found, read it in.
|
||||
if err := viper.ReadInConfig(); err == nil {
|
||||
|
|
Loading…
Reference in a new issue