From 52603fea03cedc88314e675d2d12ef9b04eaa8c7 Mon Sep 17 00:00:00 2001 From: k1LoW Date: Sun, 12 Feb 2023 23:22:53 +0900 Subject: [PATCH 1/2] Add option `--version` `--os` `--arch` --- cmd/root.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/root.go b/cmd/root.go index 5dee972..b08c41f 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -38,6 +38,8 @@ var ( force bool ) +var opt = &gh.AssetOption{} + var rootCmd = &cobra.Command{ Use: "gh-setup", Short: "Setup asset of Github Releases", @@ -80,4 +82,7 @@ func init() { rootCmd.Flags().StringVarP(&ownerrepo, "repo", "R", "", "repository using the OWNER/REPO format") rootCmd.Flags().StringVarP(&binDir, "bin-dir", "", "", "bin directory for setup") rootCmd.Flags().BoolVarP(&force, "force", "f", false, "enable force setup") + rootCmd.Flags().StringVarP(&opt.Version, "version", "", "", "release version") + rootCmd.Flags().StringVarP(&opt.OS, "os", "", "", "specify OS of asset") + rootCmd.Flags().StringVarP(&opt.Arch, "arch", "", "", "specify arch of asset") } From 5806bcb05a047a7f35426302d2f4e836d9065507 Mon Sep 17 00:00:00 2001 From: k1LoW Date: Sun, 12 Feb 2023 23:40:58 +0900 Subject: [PATCH 2/2] `--version` -> `--release-version` --- cmd/root.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index b08c41f..b5cc0aa 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -51,7 +51,7 @@ var rootCmd = &cobra.Command{ if err != nil { return err } - a, fsys, err := gh.GetReleaseAsset(ctx, owner, repo, &gh.AssetOption{}) + a, fsys, err := gh.GetReleaseAsset(ctx, owner, repo, opt) if err != nil { return err } @@ -82,7 +82,7 @@ func init() { rootCmd.Flags().StringVarP(&ownerrepo, "repo", "R", "", "repository using the OWNER/REPO format") rootCmd.Flags().StringVarP(&binDir, "bin-dir", "", "", "bin directory for setup") rootCmd.Flags().BoolVarP(&force, "force", "f", false, "enable force setup") - rootCmd.Flags().StringVarP(&opt.Version, "version", "", "", "release version") - rootCmd.Flags().StringVarP(&opt.OS, "os", "", "", "specify OS of asset") - rootCmd.Flags().StringVarP(&opt.Arch, "arch", "", "", "specify arch of asset") + rootCmd.Flags().StringVarP(&opt.Version, "release-version", "V", "", "release version") + rootCmd.Flags().StringVarP(&opt.OS, "os", "O", "", "specify OS of asset") + rootCmd.Flags().StringVarP(&opt.Arch, "arch", "A", "", "specify arch of asset") }