Files
ispctl/command/common_config/link.go
T
2020-06-03 13:27:40 +03:00

36 lines
721 B
Go

package common_config
import (
"github.com/urfave/cli/v2"
"isp-ctl/bash"
"isp-ctl/flag"
"isp-ctl/service"
)
func Link() *cli.Command {
return &cli.Command{
Name: "link",
Usage: "link common configurations to module configuration",
Action: link.action,
BashComplete: bash.Get(bash.CommonConfigName, bash.ModuleName).Complete,
}
}
var link linkCommand
type linkCommand struct{}
func (g linkCommand) action(ctx *cli.Context) error {
if err := flag.CheckGlobal(ctx); err != nil {
return err
}
configName := ctx.Args().First()
moduleName := ctx.Args().Get(1)
if err := service.Config.LinkCommonConfigToModule(configName, moduleName); err != nil {
return err
}
return nil
}