-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* docs: Update readme, add demo * refactor: cmd to make it more posix * chore(deps): Add missed tool
- Loading branch information
1 parent
1f33a16
commit 63e449f
Showing
11 changed files
with
1,054 additions
and
298 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/urfave/cli/v2" | ||
) | ||
|
||
func commands(ctx context.Context) []*cli.Command { | ||
const ( | ||
cmdRun = "run" | ||
) | ||
|
||
cmds := []*cli.Command{ | ||
{ | ||
Name: cmdRun, | ||
Aliases: nil, | ||
Usage: "Runs advent-of-code application", | ||
UsageText: "", | ||
Description: "", | ||
ArgsUsage: "", | ||
Category: "", | ||
BashComplete: nil, | ||
Before: nil, | ||
After: nil, | ||
Action: menu(ctx), | ||
OnUsageError: nil, | ||
Subcommands: nil, | ||
Flags: cmdRunFlags(), | ||
SkipFlagParsing: false, | ||
HideHelp: false, | ||
HideHelpCommand: false, | ||
Hidden: false, | ||
UseShortOptionHandling: false, | ||
HelpName: "", | ||
CustomHelpTemplate: "", | ||
}, | ||
} | ||
|
||
return cmds | ||
} |
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,48 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/urfave/cli/v2" | ||
) | ||
|
||
const ( | ||
flagElapsed = "elapsed" | ||
flagShortElapsed = "e" | ||
flagBenchmark = "bench" | ||
flagShortBenchmark = "b" | ||
) | ||
|
||
func cmdRunFlags() []cli.Flag { | ||
var res []cli.Flag | ||
|
||
elapsed := cli.BoolFlag{ | ||
Name: flagElapsed, | ||
Aliases: []string{flagShortElapsed}, | ||
Usage: "Enables elapsed time metric", | ||
EnvVars: nil, | ||
FilePath: "", | ||
Required: false, | ||
Hidden: false, | ||
Value: false, | ||
DefaultText: "", | ||
Destination: nil, | ||
HasBeenSet: false, | ||
} | ||
|
||
benchmark := cli.BoolFlag{ | ||
Name: flagBenchmark, | ||
Aliases: []string{flagShortBenchmark}, | ||
Usage: "Enables benchmark metric", | ||
EnvVars: nil, | ||
FilePath: "", | ||
Required: false, | ||
Hidden: false, | ||
Value: false, | ||
DefaultText: "", | ||
Destination: nil, | ||
HasBeenSet: false, | ||
} | ||
|
||
res = append(res, &elapsed, &benchmark) | ||
|
||
return res | ||
} |
Oops, something went wrong.