Skip to content

Commit

Permalink
Fix version command (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmiranda authored Nov 29, 2021
1 parent ba1b21b commit 014e7b5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ builds:
- env:
- CGO_ENABLED=0
ldflags:
- '-s -w -X main.AppVersion={{.Version}}'
- '-s -w -X github.com/mmiranda/cfdtunnel/cmd.version={{.Version}} -X github.com/mmiranda/cfdtunnel/cmd.commit={{.Commit}} -X github.com/mmiranda/cfdtunnel/cmd.date={{.Date}}'
goos:
- linux
- darwin
Expand Down Expand Up @@ -50,4 +50,4 @@ brews:
license: "MIT"

test: |
system "#{bin}/program", "--version"
system "#{bin}/program", "version"
5 changes: 3 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ var rootCmd = &cobra.Command{
Long: `cfdtunnel creates your cloudflare tunnel clients
on the fly only when you need to use them.`,
Args: func(cmd *cobra.Command, args []string) error {

if len(args) < 1 {
return errors.New("sub-command to execute is required")
}
Expand Down Expand Up @@ -66,8 +67,8 @@ func init() {
rootCmd.AddCommand(versionCmd)
rootCmd.CompletionOptions.DisableDefaultCmd = true

rootCmd.PersistentFlags().StringVar(&profile, "profile", "", "Which cfdtunnel profile to use")
_ = rootCmd.MarkPersistentFlagRequired("profile")
rootCmd.Flags().StringVar(&profile, "profile", "", "Which cfdtunnel profile to use")
_ = rootCmd.MarkFlagRequired("profile")
rootCmd.PersistentFlags().BoolVarP(&debug, "debug", "d", false, "Enable Debug Mode.")

// rootCmd.SetUsageFunc(func(*cobra.Command) error { return nil })
Expand Down

0 comments on commit 014e7b5

Please sign in to comment.