From 21a2262d0c605bc6e0a8a11ba646555399d478ab Mon Sep 17 00:00:00 2001 From: Gorbunov Kirill Andreevich Date: Sun, 31 Mar 2024 15:57:00 +0300 Subject: [PATCH] #8 rename method on command. --- Makefile | 2 +- cmd/pkgdashcli/main.go | 12 ++++++------ internal/configcli/config.go | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index d7d1440..0e7bf67 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ build: .PHONY: buildcli buildcli: - CGO_ENABLED=0 go build -o bin/app -mod=readonly git.unistack.org/unistack-org/pkgdash/cmd/pkgdashcli + CGO_ENABLED=0 go build -o pkgdashcli -mod=readonly git.unistack.org/unistack-org/pkgdash/cmd/pkgdashcli .PHONY: cli cli: diff --git a/cmd/pkgdashcli/main.go b/cmd/pkgdashcli/main.go index 20e7653..9836dcb 100644 --- a/cmd/pkgdashcli/main.go +++ b/cmd/pkgdashcli/main.go @@ -45,11 +45,11 @@ var initMsg = ` merge requests in version control systems. Usage: - pkgdashcli --method {{method}} --path {{name of dep}} + pkgdashcli --command {{command}} --path {{name of dep}} Commands: - checkupdate | CheckUpdate collects a list of dependencies with the latest updates. - list | Returns a list of PR for this repository with update dependencies. + checkupdate | CheckUpdate collects a list of dependencies with the latest updates. + list | Returns a list of PR for this repository with update dependencies. update --path {{name of one dep or empty for update all dep}} | Creates a PR with the specified dependency update in path or creates a PR with dependency updates for all modules if path is empty. close --path {{name of one dep or empty for close all pr}} | Closes the PR for the specified dependency or closes all PRs with dependency updates if path is empty . @@ -164,8 +164,8 @@ func main() { logger.Fatal(ctx, fmt.Sprintf("load cli cfg failed: %v", err)) } - if cliCfg.Path == "" && cliCfg.Method == "" { - logger.Info(ctx, initMsg) + if cliCfg.Path == "" && cliCfg.Command == "" { + fmt.Print(initMsg) return } @@ -241,7 +241,7 @@ func Execute(ctx context.Context, gitSource source.SourceControl, mvs map[string var path string prList := make(map[string]map[string]string) - switch cliCfg.Method { + switch cliCfg.Command { case "checkupdate": logger.Info(ctx, fmt.Sprintf("Modules get update: \n %s", mvs)) case "update": diff --git a/internal/configcli/config.go b/internal/configcli/config.go index c824095..79f793c 100644 --- a/internal/configcli/config.go +++ b/internal/configcli/config.go @@ -24,8 +24,8 @@ type UpdateOpt struct { } type Cli struct { - Method string `flag:"name=method,desc='choice method(update, close, checkupdaue, list)',default=''"` - Path string `flag:"name=path,desc='title of mod',default=''"` + Command string `flag:"name=command,desc='choice command(update, close, checkupdaue, list)',default=''"` + Path string `flag:"name=path,desc='title of mod',default=''"` } func NewConfig() *Config {