cmd/ctrld: only add "--iface" if not changed for start/stop aliases

This commit is contained in:
Cuong Manh Le
2023-01-19 22:51:32 +07:00
committed by Cuong Manh Le
parent a9fabd1b79
commit dc7d77b22e
+6 -2
View File
@@ -388,7 +388,9 @@ func initCLI() {
Use: "start", Use: "start",
Short: "Quick start service and configure DNS on interface", Short: "Quick start service and configure DNS on interface",
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
os.Args = append(os.Args, "--iface="+ifaceStartStop) if !cmd.Flags().Changed("iface") {
os.Args = append(os.Args, "--iface="+ifaceStartStop)
}
startCmd.Run(cmd, args) startCmd.Run(cmd, args)
}, },
} }
@@ -399,7 +401,9 @@ func initCLI() {
Use: "stop", Use: "stop",
Short: "Quick stop service and remove DNS from interface", Short: "Quick stop service and remove DNS from interface",
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
os.Args = append(os.Args, "--iface="+ifaceStartStop) if !cmd.Flags().Changed("iface") {
os.Args = append(os.Args, "--iface="+ifaceStartStop)
}
stopCmd.Run(cmd, args) stopCmd.Run(cmd, args)
}, },
} }