refactor: fix createStartCommands to follow single responsibility principle

Remove rootCmd.AddCommand call from createStartCommands function.
The function should only create and return commands, not add them
to the root command hierarchy. This responsibility belongs to the
caller (InitServiceCmd).

This change improves:
- Separation of concerns: function has single responsibility
- Testability: no hidden side effects
- Flexibility: caller controls command registration
- Clean architecture: follows principle of no hidden dependencies
This commit is contained in:
Cuong Manh Le
2025-07-29 16:51:18 +07:00
committed by Cuong Manh Le
parent a22f0579d5
commit ca505f1140

View File

@@ -373,7 +373,6 @@ NOTE: running "ctrld start" without any arguments will start already installed c
}
startCmdAlias.Flags().StringVarP(&ifaceStartStop, "iface", "", "auto", `Update DNS setting for iface, "auto" means the default interface gateway`)
startCmdAlias.Flags().AddFlagSet(startCmd.Flags())
rootCmd.AddCommand(startCmdAlias)
return startCmd, startCmdAlias
}