Skip to content

Commit

Permalink
Add version as flagset to Roy
Browse files Browse the repository at this point in the history
Also removes extraneous error check from Siegfried when returning
version.
  • Loading branch information
ross-spencer committed Sep 25, 2024
1 parent 09ca73a commit a74bcc4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 9 additions & 0 deletions cmd/roy/roy.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Usage:
roy inspect -help
roy sets -help
roy compare -help
roy version
`

var inspectUsage = `
Expand Down Expand Up @@ -117,6 +118,10 @@ Additional flags:
`

var (
// GENERAL.
version = flag.NewFlagSet("version | add", flag.ExitOnError)
//versionShort = flag.Bool("v", false, "display version information")
//version = flag.Bool("version", false, "display version information")
// BUILD, ADD flag sets
build = flag.NewFlagSet("build | add", flag.ExitOnError)
home = build.String("home", config.Home(), "override the default home directory")
Expand Down Expand Up @@ -529,6 +534,10 @@ func main() {
}

switch os.Args[1] {
case "version":
version := config.Version()
fmt.Printf("roy %d.%d.%d\n", version[0], version[1], version[2])
return
case "build":
err = build.Parse(os.Args[2:])
if err == nil {
Expand Down
3 changes: 0 additions & 3 deletions cmd/sf/sf.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,6 @@ func main() {
if *version || *versionShort {
version := config.Version()
fmt.Printf("siegfried %d.%d.%d\n", version[0], version[1], version[2])
if err != nil {
log.Fatalf("[FATAL] %v", err)
}
fmt.Printf("%s (%s)\nidentifiers: \n", config.Signature(), s.C.Format(time.RFC3339))
for _, id := range s.Identifiers() {
fmt.Printf(" - %s: %s\n", id[0], id[1])
Expand Down

0 comments on commit a74bcc4

Please sign in to comment.