diff --git a/cmd/cli/commands_service.go b/cmd/cli/commands_service.go index e8f781b..88ad552 100644 --- a/cmd/cli/commands_service.go +++ b/cmd/cli/commands_service.go @@ -21,6 +21,17 @@ import ( "github.com/Control-D-Inc/ctrld" ) +// filterEmptyStrings removes empty strings from a slice +func filterEmptyStrings(slice []string) []string { + var result []string + for _, s := range slice { + if s != "" { + result = append(result, s) + } + } + return result +} + // ServiceCommand handles service-related operations type ServiceCommand struct { serviceManager *ServiceManager diff --git a/cmd/cli/commands.go b/cmd/cli/commands_service_manager.go similarity index 54% rename from cmd/cli/commands.go rename to cmd/cli/commands_service_manager.go index 9227e2b..2b35e8e 100644 --- a/cmd/cli/commands.go +++ b/cmd/cli/commands_service_manager.go @@ -5,22 +5,11 @@ import ( "time" "github.com/kardianos/service" - "github.com/spf13/cobra" ) // dialSocketControlServerTimeout is the default timeout to wait when ping control server. const dialSocketControlServerTimeout = 30 * time.Second -// CommandRunner interface for dependency injection and testing -type CommandRunner interface { - RunServiceCommand(cmd *cobra.Command, args []string) error - RunLogCommand(cmd *cobra.Command, args []string) error - RunStatusCommand(cmd *cobra.Command, args []string) error - RunUpgradeCommand(cmd *cobra.Command, args []string) error - RunClientsCommand(cmd *cobra.Command, args []string) error - RunInterfacesCommand(cmd *cobra.Command, args []string) error -} - // ServiceManager handles service operations type ServiceManager struct { prog *prog @@ -50,17 +39,3 @@ func NewServiceManager() (*ServiceManager, error) { func (sm *ServiceManager) Status() (service.Status, error) { return sm.svc.Status() } - -// initLogCmd is now implemented in commands_log.go as InitLogCmd -// initRunCmd is now implemented in commands_run.go as InitRunCmd - -// filterEmptyStrings removes empty strings from a slice -func filterEmptyStrings(slice []string) []string { - var result []string - for _, s := range slice { - if s != "" { - result = append(result, s) - } - } - return result -}