Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

Commit d125b96

Browse files
committed
fix: Use common pointer for common flags for dhclientctl
1 parent 0eaa710 commit d125b96

File tree

4 files changed

+6
-11
lines changed

4 files changed

+6
-11
lines changed

cmd/dhclientctl/cmd/apply.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ var applyCmd = &cobra.Command{
5151

5252
func init() {
5353
var (
54-
serverHostPortFlag string
55-
configFileFlag string
56-
deviceFlag string
54+
deviceFlag string
5755
)
5856

5957
applyCmd.PersistentFlags().StringVarP(&serverHostPortFlag, serverHostPortKey, "s", constants.DHClientDHostPortDefault, constants.HostPortDocs)

cmd/dhclientctl/cmd/constants.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,8 @@ const (
77
configFileKey = keyPrefix + "configFile"
88
deviceKey = keyPrefix + "device"
99
)
10+
11+
var (
12+
serverHostPortFlag string
13+
configFileFlag string
14+
)

cmd/dhclientctl/cmd/delete.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,6 @@ var deleteCmd = &cobra.Command{
6060
}
6161

6262
func init() {
63-
var (
64-
serverHostPortFlag string
65-
)
66-
6763
deleteCmd.PersistentFlags().StringVarP(&serverHostPortFlag, serverHostPortKey, "s", constants.DHClientDHostPortDefault, constants.HostPortDocs)
6864

6965
if err := viper.BindPFlags(deleteCmd.PersistentFlags()); err != nil {

cmd/dhclientctl/cmd/get.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,6 @@ var getCmd = &cobra.Command{
7171
}
7272

7373
func init() {
74-
var (
75-
serverHostPortFlag string
76-
)
77-
7874
getCmd.PersistentFlags().StringVarP(&serverHostPortFlag, serverHostPortKey, "s", constants.DHClientDHostPortDefault, constants.HostPortDocs)
7975

8076
if err := viper.BindPFlags(getCmd.PersistentFlags()); err != nil {

0 commit comments

Comments
 (0)