-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from symflower/rewrite-go-flags
Rewrite binary with go-flags because it is much easier to extend
- Loading branch information
Showing
5 changed files
with
102 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package cmd | ||
|
||
import ( | ||
"log" | ||
"os" | ||
|
||
"github.com/jessevdk/go-flags" | ||
) | ||
|
||
// Command holds the root command. | ||
type Command struct { | ||
Evaluate `command:"evaluate" description:"Run an evaluation, by default with all defined models, repositories and tasks."` | ||
} | ||
|
||
// Execute executes the root command. | ||
func Execute() { | ||
var parser = flags.NewNamedParser("eval-symflower-codegen-testing", flags.Default) | ||
parser.LongDescription = "Command to manage, update and actually execute the `eval-symflower-codegen-testing` evaluation benchmark." | ||
if _, err := parser.AddGroup("Common command options", "", &Command{}); err != nil { | ||
log.Fatalf("Could not add arguments group: %+v", err) | ||
} | ||
|
||
// Print the help, when there is no active command. | ||
parser.SubcommandsOptional = true | ||
|
||
if _, err := parser.Parse(); err != nil { | ||
if e, ok := err.(*flags.Error); ok && e.Type == flags.ErrHelp { | ||
return | ||
} | ||
|
||
log.Fatalf("Could not parse arguments: %+v", err) | ||
} | ||
if parser.Active == nil { | ||
parser.WriteHelp(os.Stdout) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters