diff --git a/cmd/command/define.go b/cmd/command/define.go index 8ed6d74..48eee70 100644 --- a/cmd/command/define.go +++ b/cmd/command/define.go @@ -24,6 +24,12 @@ var defineCmd = &cobra.Command{ define.ContextKeyLocation: simpleCmdFlag.location, define.ContextKeyCommandManaged: false, })), "install failed") + + define.Logger.Info("defined command", map[string]interface{}{ + "name": simpleCmdFlag.name, + "version": simpleCmdFlag.version, + "location": simpleCmdFlag.location, + }) }, } diff --git a/cmd/command/install.go b/cmd/command/install.go index 097bb4a..d214415 100644 --- a/cmd/command/install.go +++ b/cmd/command/install.go @@ -26,6 +26,12 @@ var installCmd = &cobra.Command{ define.ContextKeyLocation: simpleCmdFlag.location, define.ContextKeyCommandManaged: true, })), "install failed") + + define.Logger.Info("installed command", map[string]interface{}{ + "name": simpleCmdFlag.name, + "version": simpleCmdFlag.version, + "location": simpleCmdFlag.location, + }) }, } diff --git a/cmd/command/list.go b/cmd/command/list.go index 6ecb6e3..d31b1c4 100644 --- a/cmd/command/list.go +++ b/cmd/command/list.go @@ -9,9 +9,6 @@ import ( ) var listCmdFlag struct { - name string - version string - location string activated bool } @@ -23,7 +20,7 @@ var listCmd = &cobra.Command{ runner := core.NewStepRunner( core.NewDBClientMaker(), core.NewSimpleCommandsQuerier( - listCmdFlag.name, listCmdFlag.version, listCmdFlag.location, listCmdFlag.activated, + simpleCmdFlag.name, simpleCmdFlag.version, simpleCmdFlag.location, listCmdFlag.activated, ), core.NewCommandPrinter(), ) @@ -40,7 +37,7 @@ func init() { Cmd.AddCommand(listCmd) flags := listCmd.Flags() - flags.StringVarP(&listCmdFlag.name, "name", "n", "", "command name") - flags.StringVarP(&listCmdFlag.version, "version", "v", "", "command version") - flags.StringVarP(&listCmdFlag.location, "location", "l", "", "command location") + flags.StringVarP(&simpleCmdFlag.name, "name", "n", "", "command name") + flags.StringVarP(&simpleCmdFlag.version, "version", "v", "", "command version") + flags.StringVarP(&simpleCmdFlag.location, "location", "l", "", "command location") } diff --git a/cmd/command/uninstall.go b/cmd/command/uninstall.go index 6e2e9ca..4fd0d1f 100644 --- a/cmd/command/uninstall.go +++ b/cmd/command/uninstall.go @@ -26,6 +26,12 @@ var uninstallCmd = &cobra.Command{ define.ContextKeyName: simpleCmdFlag.name, define.ContextKeyVersion: simpleCmdFlag.version, })), "list failed") + + define.Logger.Info("uninstalled command", map[string]interface{}{ + "name": simpleCmdFlag.name, + "version": simpleCmdFlag.version, + "location": simpleCmdFlag.location, + }) }, } diff --git a/cmd/command/unset.go b/cmd/command/unset.go index 310d2df..5aa90df 100644 --- a/cmd/command/unset.go +++ b/cmd/command/unset.go @@ -21,6 +21,10 @@ var unsetCmd = &cobra.Command{ utils.ExitWithError(runner.Run(utils.SetIntoContext(cmd.Context(), map[define.ContextKey]interface{}{ define.ContextKeyName: simpleCmdFlag.name, })), "deactivate failed") + + define.Logger.Info("unset command", map[string]interface{}{ + "name": simpleCmdFlag.name, + }) }, } diff --git a/cmd/command/use.go b/cmd/command/use.go index d7473af..67f4ba3 100644 --- a/cmd/command/use.go +++ b/cmd/command/use.go @@ -26,6 +26,11 @@ var useCmd = &cobra.Command{ define.ContextKeyVersion: simpleCmdFlag.version, define.ContextKeyLocation: simpleCmdFlag.location, })), "activate failed") + + define.Logger.Info("used command", map[string]interface{}{ + "name": simpleCmdFlag.name, + "version": simpleCmdFlag.version, + }) }, } diff --git a/core/step.go b/core/step.go index bd175dc..4bd8397 100644 --- a/core/step.go +++ b/core/step.go @@ -55,7 +55,7 @@ func (r *StepRunner) Run(ctx context.Context) (err error) { } defer func(step Steper) { - logger.Info("step finished", map[string]interface{}{ + logger.Debug("step finished", map[string]interface{}{ "step": step, })