MSP-5014 Try get rid of global service and autocomplete
This commit is contained in:
1 parent
84f639a9d3
commit
c267b1ae6e
15 files changed
+468
-335
No files matched your search
+39
-10
@@ -1,16 +1,45 @@
|
||||
package command
|
||||
|
||||
import "github.com/urfave/cli/v2"
|
||||
import (
|
||||
"ispctl/model"
|
||||
|
||||
func AllCommands() []*cli.Command {
|
||||
"github.com/txix-open/isp-kit/rc/schema"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
type AutoComplete interface {
|
||||
Complete(first string, second string) cli.BashCompleteFunc
|
||||
}
|
||||
|
||||
type ConfigService interface {
|
||||
CreateUpdateConfig(stringToChange string, configuration *model.Config) (map[string]any, error)
|
||||
CreateUpdateConfigV2(configuration *model.Config) (map[string]any, error)
|
||||
DeleteVariable(variableName string) error
|
||||
GetAllVariables() ([]model.Variable, error)
|
||||
GetAvailableConfigs() ([]model.ModuleInfo, error)
|
||||
GetConfigurationByModuleName(moduleName string) (*model.Config, error)
|
||||
GetSchemaByModuleId(moduleId string) (schema.Schema, error)
|
||||
GetVariableByName(variableName string) (*model.Variable, error)
|
||||
UpsertVariables(vars []model.UpsertVariableRequest) error
|
||||
}
|
||||
|
||||
func AllCommands(configService ConfigService, autoComplete AutoComplete) []*cli.Command {
|
||||
status := NewStatus(configService)
|
||||
get := NewGet(configService, autoComplete)
|
||||
set := NewSet(configService, autoComplete)
|
||||
delete := NewDelete(configService, autoComplete)
|
||||
schema := NewSchema(configService, autoComplete)
|
||||
merge := NewMerge(configService, autoComplete)
|
||||
gitGet := NewGitGet()
|
||||
variables := NewVariables(configService, autoComplete)
|
||||
return []*cli.Command{
|
||||
Status(),
|
||||
Get(),
|
||||
Set(),
|
||||
Delete(),
|
||||
Schema(),
|
||||
Merge(),
|
||||
GitGet(),
|
||||
VariablesCommands(),
|
||||
status.Command(),
|
||||
get.Command(),
|
||||
set.Command(),
|
||||
delete.Command(),
|
||||
schema.Command(),
|
||||
merge.Command(),
|
||||
gitGet.Command(),
|
||||
variables.Command(),
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user