From 4b0a8641e58ff3df3e585985f70f2ca2a1f09e42 Mon Sep 17 00:00:00 2001 From: Chris Aubuchon Date: Fri, 24 Jul 2015 11:11:37 -0500 Subject: [PATCH] Make adding --dc and --wait-index variables a bit clearer --- command/acl_clone.go | 2 +- command/acl_create.go | 2 +- command/acl_destroy.go | 2 +- command/acl_info.go | 2 +- command/acl_list.go | 2 +- command/acl_update.go | 2 +- command/agent_checks.go | 2 +- command/agent_force_leave.go | 2 +- command/agent_join.go | 2 +- command/agent_maintenance.go | 2 +- command/agent_members.go | 2 +- command/agent_self.go | 2 +- command/agent_services.go | 2 +- command/check_deregister.go | 2 +- command/check_fail.go | 2 +- command/check_pass.go | 2 +- command/check_register.go | 2 +- command/check_warn.go | 2 +- command/health_checks.go | 3 ++- command/health_node.go | 3 ++- command/health_service.go | 3 ++- command/health_state.go | 3 ++- command/kv_delete.go | 18 +++++++++--------- command/kv_lock.go | 3 ++- command/kv_read.go | 29 +++++++++++++++-------------- command/kv_unlock.go | 3 ++- command/kv_write.go | 24 ++++++++++++------------ command/meta.go | 26 ++++++++++++++++++++++++-- command/service_deregister.go | 2 +- command/service_maintenance.go | 2 +- command/service_register.go | 2 +- command/session_create.go | 3 ++- command/session_destroy.go | 3 ++- command/session_info.go | 3 ++- command/session_list.go | 3 ++- command/session_node.go | 3 ++- command/session_renew.go | 3 ++- command/status_leader.go | 2 +- command/status_peers.go | 2 +- 39 files changed, 107 insertions(+), 72 deletions(-) diff --git a/command/acl_clone.go b/command/acl_clone.go index a6690fd..2eb8872 100644 --- a/command/acl_clone.go +++ b/command/acl_clone.go @@ -22,7 +22,7 @@ Options: } func (c *ACLCloneCommand) Run(args []string) int { - flags := c.Meta.FlagSet(false) + flags := c.Meta.FlagSet() flags.Usage = func() { c.UI.Output(c.Help()) } if err := flags.Parse(args); err != nil { diff --git a/command/acl_create.go b/command/acl_create.go index cdbf973..f603940 100644 --- a/command/acl_create.go +++ b/command/acl_create.go @@ -44,7 +44,7 @@ func (c *ACLCreateCommand) Run(args []string) int { var isManagement bool var aclName string - flags := c.Meta.FlagSet(false) + flags := c.Meta.FlagSet() flags.StringVar(&aclName, "name", "", "") flags.BoolVar(&isManagement, "management", false, "") flags.Var((funcVar)(func(s string) error { diff --git a/command/acl_destroy.go b/command/acl_destroy.go index c5e7abd..ca387ff 100644 --- a/command/acl_destroy.go +++ b/command/acl_destroy.go @@ -22,7 +22,7 @@ Options: } func (c *ACLDestroyCommand) Run(args []string) int { - flags := c.Meta.FlagSet(false) + flags := c.Meta.FlagSet() flags.Usage = func() { c.UI.Output(c.Help()) } if err := flags.Parse(args); err != nil { diff --git a/command/acl_info.go b/command/acl_info.go index e6fd81c..116db82 100644 --- a/command/acl_info.go +++ b/command/acl_info.go @@ -22,7 +22,7 @@ Options: } func (c *ACLInfoCommand) Run(args []string) int { - flags := c.Meta.FlagSet(false) + flags := c.Meta.FlagSet() flags.Usage = func() { c.UI.Output(c.Help()) } if err := flags.Parse(args); err != nil { diff --git a/command/acl_list.go b/command/acl_list.go index 5ab0112..47ff8f8 100644 --- a/command/acl_list.go +++ b/command/acl_list.go @@ -22,7 +22,7 @@ Options: } func (c *ACLListCommand) Run(args []string) int { - flags := c.Meta.FlagSet(false) + flags := c.Meta.FlagSet() flags.Usage = func() { c.UI.Output(c.Help()) } if err := flags.Parse(args); err != nil { diff --git a/command/acl_update.go b/command/acl_update.go index 967012f..baa8989 100644 --- a/command/acl_update.go +++ b/command/acl_update.go @@ -35,7 +35,7 @@ func (c *ACLUpdateCommand) Run(args []string) int { var isManagement bool var aclName string - flags := c.Meta.FlagSet(false) + flags := c.Meta.FlagSet() flags.StringVar(&aclName, "name", "", "") flags.BoolVar(&isManagement, "management", false, "") diff --git a/command/agent_checks.go b/command/agent_checks.go index 8fc7a2d..bba7f77 100644 --- a/command/agent_checks.go +++ b/command/agent_checks.go @@ -21,7 +21,7 @@ Options: } func (c *AgentChecksCommand) Run(args []string) int { - flags := c.Meta.FlagSet(false) + flags := c.Meta.FlagSet() flags.Usage = func() { c.UI.Output(c.Help()) } if err := flags.Parse(args); err != nil { diff --git a/command/agent_force_leave.go b/command/agent_force_leave.go index 3fb56e7..2c36233 100644 --- a/command/agent_force_leave.go +++ b/command/agent_force_leave.go @@ -21,7 +21,7 @@ Options: } func (c *AgentForceLeaveCommand) Run(args []string) int { - flags := c.Meta.FlagSet(false) + flags := c.Meta.FlagSet() flags.Usage = func() { c.UI.Output(c.Help()) } if err := flags.Parse(args); err != nil { diff --git a/command/agent_join.go b/command/agent_join.go index 377280b..6e0c7d1 100644 --- a/command/agent_join.go +++ b/command/agent_join.go @@ -25,7 +25,7 @@ Options: } func (c *AgentJoinCommand) Run(args []string) int { - flags := c.Meta.FlagSet(false) + flags := c.Meta.FlagSet() flags.BoolVar(&c.joinWAN, "wan", false, "") flags.Usage = func() { c.UI.Output(c.Help()) } diff --git a/command/agent_maintenance.go b/command/agent_maintenance.go index 8a7b154..4f8929b 100644 --- a/command/agent_maintenance.go +++ b/command/agent_maintenance.go @@ -28,7 +28,7 @@ Options: } func (c *AgentMaintenanceCommand) Run(args []string) int { - flags := c.Meta.FlagSet(false) + flags := c.Meta.FlagSet() flags.BoolVar(&c.enabled, "enabled", true, "") flags.StringVar(&c.reason, "reason", "", "") flags.Usage = func() { c.UI.Output(c.Help()) } diff --git a/command/agent_members.go b/command/agent_members.go index 8dc760b..135a310 100644 --- a/command/agent_members.go +++ b/command/agent_members.go @@ -25,7 +25,7 @@ Options: } func (c *AgentMembersCommand) Run(args []string) int { - flags := c.Meta.FlagSet(false) + flags := c.Meta.FlagSet() flags.BoolVar(&c.wanFlag, "wan", false, "") flags.Usage = func() { c.UI.Output(c.Help()) } diff --git a/command/agent_self.go b/command/agent_self.go index 617d6c1..e6d3c45 100644 --- a/command/agent_self.go +++ b/command/agent_self.go @@ -21,7 +21,7 @@ Options: } func (c *AgentSelfCommand) Run(args []string) int { - flags := c.Meta.FlagSet(false) + flags := c.Meta.FlagSet() flags.Usage = func() { c.UI.Output(c.Help()) } if err := flags.Parse(args); err != nil { diff --git a/command/agent_services.go b/command/agent_services.go index 6a7fe08..7b1a3be 100644 --- a/command/agent_services.go +++ b/command/agent_services.go @@ -21,7 +21,7 @@ Options: } func (c *AgentServicesCommand) Run(args []string) int { - flags := c.Meta.FlagSet(false) + flags := c.Meta.FlagSet() flags.Usage = func() { c.UI.Output(c.Help()) } if err := flags.Parse(args); err != nil { diff --git a/command/check_deregister.go b/command/check_deregister.go index 7636ada..87685c3 100644 --- a/command/check_deregister.go +++ b/command/check_deregister.go @@ -21,7 +21,7 @@ Options: } func (c *CheckDeregisterCommand) Run(args []string) int { - flags := c.Meta.FlagSet(false) + flags := c.Meta.FlagSet() flags.Usage = func() { c.UI.Output(c.Help()) } if err := flags.Parse(args); err != nil { diff --git a/command/check_fail.go b/command/check_fail.go index 071033e..8f610da 100644 --- a/command/check_fail.go +++ b/command/check_fail.go @@ -25,7 +25,7 @@ Options: } func (c *CheckFailCommand) Run(args []string) int { - flags := c.Meta.FlagSet(false) + flags := c.Meta.FlagSet() flags.StringVar(&c.note, "note", "", "") flags.Usage = func() { c.UI.Output(c.Help()) } diff --git a/command/check_pass.go b/command/check_pass.go index 1b59166..9b0fb4b 100644 --- a/command/check_pass.go +++ b/command/check_pass.go @@ -25,7 +25,7 @@ Options: } func (c *CheckPassCommand) Run(args []string) int { - flags := c.Meta.FlagSet(false) + flags := c.Meta.FlagSet() flags.StringVar(&c.note, "note", "", "") flags.Usage = func() { c.UI.Output(c.Help()) } diff --git a/command/check_register.go b/command/check_register.go index 4a5eb45..f553213 100644 --- a/command/check_register.go +++ b/command/check_register.go @@ -51,7 +51,7 @@ Options: } func (c *CheckRegisterCommand) Run(args []string) int { - flags := c.Meta.FlagSet(false) + flags := c.Meta.FlagSet() flags.StringVar(&c.id, "id", "", "") flags.StringVar(&c.http, "http", "", "") flags.StringVar(&c.script, "script", "", "") diff --git a/command/check_warn.go b/command/check_warn.go index 0bb8af1..9e6788a 100644 --- a/command/check_warn.go +++ b/command/check_warn.go @@ -25,7 +25,7 @@ Options: } func (c *CheckWarnCommand) Run(args []string) int { - flags := c.Meta.FlagSet(false) + flags := c.Meta.FlagSet() flags.StringVar(&c.note, "note", "", "") flags.Usage = func() { c.UI.Output(c.Help()) } diff --git a/command/health_checks.go b/command/health_checks.go index 857228b..ff9b41f 100644 --- a/command/health_checks.go +++ b/command/health_checks.go @@ -22,7 +22,8 @@ Options: } func (c *HealthChecksCommand) Run(args []string) int { - flags := c.Meta.FlagSet(true) + c.AddDataCenter() + flags := c.Meta.FlagSet() flags.Usage = func() { c.UI.Output(c.Help()) } if err := flags.Parse(args); err != nil { diff --git a/command/health_node.go b/command/health_node.go index b9d3bc5..1e6e584 100644 --- a/command/health_node.go +++ b/command/health_node.go @@ -22,7 +22,8 @@ Options: } func (c *HealthNodeCommand) Run(args []string) int { - flags := c.Meta.FlagSet(true) + c.AddDataCenter() + flags := c.Meta.FlagSet() flags.Usage = func() { c.UI.Output(c.Help()) } if err := flags.Parse(args); err != nil { diff --git a/command/health_service.go b/command/health_service.go index 49a483e..2d6be51 100644 --- a/command/health_service.go +++ b/command/health_service.go @@ -29,7 +29,8 @@ Options: } func (c *HealthServiceCommand) Run(args []string) int { - flags := c.Meta.FlagSet(true) + c.AddDataCenter() + flags := c.Meta.FlagSet() flags.StringVar(&c.tag, "tag", "", "") flags.BoolVar(&c.passingOnly, "passing", false, "") flags.Usage = func() { c.UI.Output(c.Help()) } diff --git a/command/health_state.go b/command/health_state.go index d17c899..f5f9ccb 100644 --- a/command/health_state.go +++ b/command/health_state.go @@ -22,7 +22,8 @@ Options: } func (c *HealthStateCommand) Run(args []string) int { - flags := c.Meta.FlagSet(true) + c.AddDataCenter() + flags := c.Meta.FlagSet() flags.Usage = func() { c.UI.Output(c.Help()) } if err := flags.Parse(args); err != nil { diff --git a/command/kv_delete.go b/command/kv_delete.go index 3d7bf0c..3b61aa2 100644 --- a/command/kv_delete.go +++ b/command/kv_delete.go @@ -9,6 +9,8 @@ import ( type KVDeleteCommand struct { Meta + modifyIndex string + doRecurse bool } func (c *KVDeleteCommand) Help() string { @@ -30,12 +32,10 @@ Options: } func (c *KVDeleteCommand) Run (args[]string) int { - var modifyIndex string - var doRecurse bool - - flags := c.Meta.FlagSet(true) - flags.StringVar(&modifyIndex, "modifyindex", "", "") - flags.BoolVar(&doRecurse, "recurse", false, "") + c.AddDataCenter() + flags := c.Meta.FlagSet() + flags.StringVar(&c.modifyIndex, "modifyindex", "", "") + flags.BoolVar(&c.doRecurse, "recurse", false, "") flags.Usage = func() { c.UI.Output(c.Help()) } if err := flags.Parse(args); err != nil { @@ -62,14 +62,14 @@ func (c *KVDeleteCommand) Run (args[]string) int { writeOpts := c.WriteOptions() switch { - case doRecurse: + case c.doRecurse: _, err := client.DeleteTree(path, writeOpts) if err != nil { c.UI.Error(err.Error()) return 1 } - case modifyIndex != "": - m, err := strconv.ParseUint(modifyIndex, 0, 64) + case c.modifyIndex != "": + m, err := strconv.ParseUint(c.modifyIndex, 0, 64) if err != nil { c.UI.Error(err.Error()) return 1 diff --git a/command/kv_lock.go b/command/kv_lock.go index 0429502..6138498 100644 --- a/command/kv_lock.go +++ b/command/kv_lock.go @@ -44,7 +44,8 @@ func (c *KVLockCommand) Run(args []string) int { c.cleanSession = false - flags := c.Meta.FlagSet(true) + c.AddDataCenter() + flags := c.Meta.FlagSet() flags.StringVar(&c.behavior, "behavior", "release", "") flags.StringVar(&c.ttl, "ttl", "", "") flags.DurationVar(&c.lockDelay, "lock-delay", time.Second * 15, "") diff --git a/command/kv_read.go b/command/kv_read.go index 8dc2ce3..1787e1e 100644 --- a/command/kv_read.go +++ b/command/kv_read.go @@ -6,6 +6,9 @@ import ( type KVReadCommand struct { Meta + format OutputFormat + fieldsRaw string + recurse bool } func (c *KVReadCommand) Help() string { @@ -33,16 +36,14 @@ Options: } func (c *KVReadCommand) Run(args []string) int { - var format OutputFormat - var fieldsRaw string - var recurse bool - - flags := c.Meta.FlagSet(true) - flags.StringVar(&fieldsRaw, "fields", "value", "") - flags.StringVar(&format.Type, "format", "text", "") - flags.StringVar(&format.Delimiter, "delimiter", " ", "") - flags.BoolVar(&format.Header, "header", false, "") - flags.BoolVar(&recurse, "recurse", false, "") + c.AddDataCenter() + + flags := c.Meta.FlagSet() + flags.StringVar(&c.fieldsRaw, "fields", "value", "") + flags.StringVar(&c.format.Type, "format", "text", "") + flags.StringVar(&c.format.Delimiter, "delimiter", " ", "") + flags.BoolVar(&c.format.Header, "header", false, "") + flags.BoolVar(&c.recurse, "recurse", false, "") flags.Usage = func() { c.UI.Output(c.Help()) } if err := flags.Parse(args); err != nil { @@ -68,9 +69,9 @@ func (c *KVReadCommand) Run(args []string) int { queryOpts := c.QueryOptions() - kvo := NewKVOutput(c.UI, fieldsRaw) + kvo := NewKVOutput(c.UI, c.fieldsRaw) - if recurse { + if c.recurse { kvlist, _, err := client.List(path, queryOpts) if err != nil { c.UI.Error(err.Error()) @@ -81,7 +82,7 @@ func (c *KVReadCommand) Run(args []string) int { return 0 } - kvo.OutputList(&kvlist, format) + kvo.OutputList(&kvlist, c.format) } else { kv, _, err := client.Get(path, queryOpts) if err != nil { @@ -93,7 +94,7 @@ func (c *KVReadCommand) Run(args []string) int { return 0 } - kvo.Output(kv, format) + kvo.Output(kv, c.format) } return 0 diff --git a/command/kv_unlock.go b/command/kv_unlock.go index eac9b9b..9cf2eb1 100644 --- a/command/kv_unlock.go +++ b/command/kv_unlock.go @@ -30,7 +30,8 @@ Options: } func (c *KVUnlockCommand) Run(args []string) int { - flags := c.Meta.FlagSet(true) + c.AddDataCenter() + flags := c.Meta.FlagSet() flags.StringVar(&c.session, "session", "", "") flags.BoolVar(&c.noDestroy, "no-destroy", false, "") flags.Usage = func() { c.UI.Output(c.Help()) } diff --git a/command/kv_write.go b/command/kv_write.go index e70cbf4..89aaeb0 100644 --- a/command/kv_write.go +++ b/command/kv_write.go @@ -11,6 +11,8 @@ import ( type KVWriteCommand struct { Meta + modifyIndex string + dataFlags string } func (c *KVWriteCommand) Help() string { @@ -31,12 +33,10 @@ Options: } func (c *KVWriteCommand) Run(args []string) int { - var modifyIndex string - var dataFlags string - - flags := c.Meta.FlagSet(true) - flags.StringVar(&modifyIndex, "cas", "", "") - flags.StringVar(&dataFlags, "flags", "", "") + c.AddDataCenter() + flags := c.Meta.FlagSet() + flags.StringVar(&c.modifyIndex, "cas", "", "") + flags.StringVar(&c.dataFlags, "flags", "", "") flags.Usage = func() { c.UI.Output(c.Help()) } if err := flags.Parse(args); err != nil { @@ -70,10 +70,10 @@ func (c *KVWriteCommand) Run(args []string) int { // &flags= // - if dataFlags != "" { - f, err := strconv.ParseUint(dataFlags, 0, 64) + if c.dataFlags != "" { + f, err := strconv.ParseUint(c.dataFlags, 0, 64) if err != nil { - c.UI.Error(fmt.Sprintf("Error parsing flags: %v", dataFlags)) + c.UI.Error(fmt.Sprintf("Error parsing flags: %v", c.dataFlags)) c.UI.Error("") return 1 } @@ -89,7 +89,7 @@ func (c *KVWriteCommand) Run(args []string) int { writeOpts := c.WriteOptions() - if modifyIndex == "" { + if c.modifyIndex == "" { _, err := client.Put(kv, writeOpts) if err != nil { c.UI.Error(err.Error()) @@ -97,9 +97,9 @@ func (c *KVWriteCommand) Run(args []string) int { } } else { // Check-and-Set - i, err := strconv.ParseUint(modifyIndex, 0, 64) + i, err := strconv.ParseUint(c.modifyIndex, 0, 64) if err != nil { - c.UI.Error(fmt.Sprintf("Error parsing modifyIndex: %v", modifyIndex)) + c.UI.Error(fmt.Sprintf("Error parsing modifyIndex: %v", c.modifyIndex)) c.UI.Error("") return 1 } diff --git a/command/meta.go b/command/meta.go index 3e67aed..0ed1fc7 100644 --- a/command/meta.go +++ b/command/meta.go @@ -21,12 +21,20 @@ type Meta struct { token string auth *Auth dc string + waitIndex uint64 hasDc bool + hasWait bool } -func (m *Meta) FlagSet(hasDc bool) *flag.FlagSet { - m.hasDc = hasDc +func (m *Meta) AddDataCenter() { + m.hasDc = true +} + +func (m *Meta) AddWait() { + m.hasWait = true +} +func (m *Meta) FlagSet() *flag.FlagSet { f := flag.NewFlagSet("consul-cli", flag.ContinueOnError) f.StringVar(&m.consulAddr, "consul", "127.0.0.1:8500", "") f.BoolVar(&m.sslEnabled, "ssl", false, "") @@ -37,6 +45,9 @@ func (m *Meta) FlagSet(hasDc bool) *flag.FlagSet { if m.hasDc { f.StringVar(&m.dc, "datacenter", "", "") } + if m.hasWait { + f.Uint64Var(&m.waitIndex, "wait-index", 0, "") + } m.auth = new(Auth) f.Var((*Auth)(m.auth), "auth", "") @@ -101,6 +112,10 @@ func (m *Meta) QueryOptions() *consulapi.QueryOptions { queryOpts.Datacenter = m.dc } + if m.waitIndex != 0 { + queryOpts.WaitIndex = m.waitIndex + } + return queryOpts } @@ -131,6 +146,13 @@ func (m *Meta) ConsulHelp() string { ` } + if m.hasWait{ + helpText = helpText + +` --wait-index= Only return if ModifyIndex is greater than + (default: 0) +` + } + return helpText } diff --git a/command/service_deregister.go b/command/service_deregister.go index 2cc8102..0649eb0 100644 --- a/command/service_deregister.go +++ b/command/service_deregister.go @@ -21,7 +21,7 @@ Options: } func (c *ServiceDeregisterCommand) Run(args []string) int { - flags := c.Meta.FlagSet(false) + flags := c.Meta.FlagSet() flags.Usage = func() { c.UI.Output(c.Help()) } if err := flags.Parse(args); err != nil { diff --git a/command/service_maintenance.go b/command/service_maintenance.go index 28eb0c7..7c2a282 100644 --- a/command/service_maintenance.go +++ b/command/service_maintenance.go @@ -28,7 +28,7 @@ Options: } func (c *ServiceMaintenanceCommand) Run(args []string) int { - flags := c.Meta.FlagSet(false) + flags := c.Meta.FlagSet() flags.BoolVar(&c.enabled, "enabled", true, "") flags.StringVar(&c.reason, "reason", "", "") flags.Usage = func() { c.UI.Output(c.Help()) } diff --git a/command/service_register.go b/command/service_register.go index 9fc8f4e..58a3a8a 100644 --- a/command/service_register.go +++ b/command/service_register.go @@ -48,7 +48,7 @@ Options: } func (c *ServiceRegisterCommand) Run(args []string) int { - flags := c.Meta.FlagSet(false) + flags := c.Meta.FlagSet() flags.StringVar(&c.id, "id", "", "") flags.Var((funcVar)(func(s string) error { if c.tags == nil { diff --git a/command/session_create.go b/command/session_create.go index 9a89b72..27a654c 100644 --- a/command/session_create.go +++ b/command/session_create.go @@ -45,7 +45,8 @@ Options: } func (c *SessionCreateCommand) Run(args []string) int { - flags := c.Meta.FlagSet(true) + c.AddDataCenter() + flags := c.Meta.FlagSet() flags.DurationVar(&c.lockDelay, "lock-delay", 0, "") flags.StringVar(&c.nodeName, "node", "", "") flags.StringVar(&c.name, "name", "", "") diff --git a/command/session_destroy.go b/command/session_destroy.go index e4e8f2e..b1166e1 100644 --- a/command/session_destroy.go +++ b/command/session_destroy.go @@ -22,7 +22,8 @@ Options: } func (c *SessionDestroyCommand) Run(args []string) int { - flags := c.Meta.FlagSet(true) + c.AddDataCenter() + flags := c.Meta.FlagSet() flags.Usage = func() { c.UI.Output(c.Help()) } if err := flags.Parse(args); err != nil { diff --git a/command/session_info.go b/command/session_info.go index 2565536..b527b04 100644 --- a/command/session_info.go +++ b/command/session_info.go @@ -22,7 +22,8 @@ Options: } func (c *SessionInfoCommand) Run(args []string) int { - flags := c.Meta.FlagSet(true) + c.AddDataCenter() + flags := c.Meta.FlagSet() flags.Usage = func() { c.UI.Output(c.Help()) } if err := flags.Parse(args); err != nil { diff --git a/command/session_list.go b/command/session_list.go index d6e000e..216c11b 100644 --- a/command/session_list.go +++ b/command/session_list.go @@ -22,7 +22,8 @@ Options: } func (c *SessionListCommand) Run(args []string) int { - flags := c.Meta.FlagSet(true) + c.AddDataCenter() + flags := c.Meta.FlagSet() flags.Usage = func() { c.UI.Output(c.Help()) } if err := flags.Parse(args); err != nil { diff --git a/command/session_node.go b/command/session_node.go index 8cdccd8..94ecf07 100644 --- a/command/session_node.go +++ b/command/session_node.go @@ -22,7 +22,8 @@ Options: } func (c *SessionNodeCommand) Run(args []string) int { - flags := c.Meta.FlagSet(true) + c.AddDataCenter() + flags := c.Meta.FlagSet() flags.Usage = func() { c.UI.Output(c.Help()) } if err := flags.Parse(args); err != nil { diff --git a/command/session_renew.go b/command/session_renew.go index 8a48602..9730c08 100644 --- a/command/session_renew.go +++ b/command/session_renew.go @@ -22,7 +22,8 @@ Options: } func (c *SessionRenewCommand) Run(args []string) int { - flags := c.Meta.FlagSet(true) + c.AddDataCenter() + flags := c.Meta.FlagSet() flags.Usage = func() { c.UI.Output(c.Help()) } if err := flags.Parse(args); err != nil { diff --git a/command/status_leader.go b/command/status_leader.go index 82431bd..06e6b6c 100644 --- a/command/status_leader.go +++ b/command/status_leader.go @@ -22,7 +22,7 @@ Options: } func (c *StatusLeaderCommand) Run(args []string) int { - flags := c.Meta.FlagSet(false) + flags := c.Meta.FlagSet() flags.Usage = func() { c.UI.Output(c.Help()) } if err := flags.Parse(args); err != nil { diff --git a/command/status_peers.go b/command/status_peers.go index 900ea0f..29e9c74 100644 --- a/command/status_peers.go +++ b/command/status_peers.go @@ -22,7 +22,7 @@ Options: } func (c *StatusPeersCommand) Run(args []string) int { - flags := c.Meta.FlagSet(false) + flags := c.Meta.FlagSet() flags.Usage = func() { c.UI.Output(c.Help()) } if err := flags.Parse(args); err != nil {