Skip to content

Commit

Permalink
close #53
Browse files Browse the repository at this point in the history
  • Loading branch information
rodber committed Dec 29, 2024
1 parent edcf29a commit 899d10e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,10 @@ var flags = map[string]cli.Flag{
Default: defaultEditor,
Description: fmt.Sprintf("Editor to use %v", editors),
},
"version": {
Variable: "Version",
Type: "bool",
Default: false,
Description: "Show version information",
},
}
5 changes: 4 additions & 1 deletion internal/cli/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ type Options struct {
SessionName string
// Editor specifies the preferred text editor
Editor string
// Version specifies the `-version` flag to return the version
Version bool
}

// NewOptions creates a new Options instance from the provided flags configuration.
Expand All @@ -61,7 +63,7 @@ func NewOptions(flags map[string]Flag) (Options, error) {
}
}
if len(validationErrors) > 0 {
return Options{}, fmt.Errorf("validation errors: %v", validationErrors)
return Options{}, fmt.Errorf("%v", validationErrors)
}
flag.Parse()
return Options{
Expand All @@ -75,5 +77,6 @@ func NewOptions(flags map[string]Flag) (Options, error) {
SignPrivateKey: *flagValues["SignPrivateKey"].(*string),
SessionName: *flagValues["SessionName"].(*string),
Editor: *flagValues["Editor"].(*string),
Version: *flagValues["Version"].(*bool),
}, nil
}

0 comments on commit 899d10e

Please sign in to comment.