Make -v count once and accept -vv for debug output (closes #125)
check / check (push) Failing after 2s
check / check (push) Failing after 2s
urfave/cli before v2.25.5 counted a flag given by its alias twice, so one -v or --verbose already gave debug output. Bump it to v2.27.7, the latest v2 release, which counts it once: one -v gives verbose output, two give debug. Turn on urfave/cli's UseShortOptionHandling so single-letter flags combine at the root and in every subcommand; -vv now works as the -v help text says. -v and --verbose together stay refused: urfave/cli v2 refuses any flag given under two of its names. The bump drops "[arguments...]" from usage lines, so generate and fetch now name their arguments. Test runs now start at the default log level. Model: opus-5-5
This commit is contained in:
+15
-9
@@ -17,6 +17,7 @@ import (
|
||||
const (
|
||||
cmdGenerate = "generate"
|
||||
cmdCheck = "check"
|
||||
cmdFreshen = "freshen"
|
||||
cmdExport = "export"
|
||||
cmdFetch = "fetch"
|
||||
cmdVersion = "version"
|
||||
@@ -131,9 +132,10 @@ func commonFlags() []cli.Flag {
|
||||
|
||||
func (mfa *CLIApp) generateCommand() *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: cmdGenerate,
|
||||
Aliases: []string{"gen"},
|
||||
Usage: "Generate manifest file",
|
||||
Name: cmdGenerate,
|
||||
Aliases: []string{"gen"},
|
||||
Usage: "Generate manifest file",
|
||||
ArgsUsage: "[path ...]",
|
||||
Action: func(c *cli.Context) error {
|
||||
mfa.setVerbosity(c)
|
||||
mfa.printBanner()
|
||||
@@ -227,7 +229,7 @@ func (mfa *CLIApp) checkCommand() *cli.Command {
|
||||
|
||||
func (mfa *CLIApp) freshenCommand() *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "freshen",
|
||||
Name: cmdFreshen,
|
||||
Usage: "Update manifest with changed, new, and removed files",
|
||||
ArgsUsage: manifestArgsUsage,
|
||||
Action: func(c *cli.Context) error {
|
||||
@@ -324,8 +326,9 @@ func (mfa *CLIApp) listCommand() *cli.Command {
|
||||
|
||||
func (mfa *CLIApp) fetchCommand() *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: cmdFetch,
|
||||
Usage: "fetch manifest and referenced files",
|
||||
Name: cmdFetch,
|
||||
Usage: "fetch manifest and referenced files",
|
||||
ArgsUsage: "[URL]",
|
||||
Action: func(c *cli.Context) error {
|
||||
mfa.setVerbosity(c)
|
||||
mfa.printBanner()
|
||||
@@ -368,9 +371,12 @@ func (mfa *CLIApp) run(args []string) {
|
||||
Usage: "Manifest generator",
|
||||
Version: mfa.VersionString(),
|
||||
EnableBashCompletion: true,
|
||||
Writer: mfa.Stdout,
|
||||
ErrWriter: mfa.Stderr,
|
||||
Flags: commonFlags(),
|
||||
// Lets single-letter flags combine, at the root and in every
|
||||
// subcommand: -vv is -v -v.
|
||||
UseShortOptionHandling: true,
|
||||
Writer: mfa.Stdout,
|
||||
ErrWriter: mfa.Stderr,
|
||||
Flags: commonFlags(),
|
||||
Action: func(c *cli.Context) error {
|
||||
if c.Args().Len() > 0 {
|
||||
return fmt.Errorf("%w %q", errUnknownCommand, c.Args().First())
|
||||
|
||||
Reference in New Issue
Block a user