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