tea icon indicating copy to clipboard operation
tea copied to clipboard

handle global Flags

Open root360-AndreasUlm opened this issue 5 years ago • 3 comments

While trying to solve #12 with PR #15 several options were discussed. To move the discussion out of the PR and summarize the available options I create this issue.

The short summary of the problem #12 pointed out is that the current CLI lib does not inherit global flags into several subcommands (see https://github.com/urfave/cli/issues/585)

The currently available options are:

  • switching to Cobra a different CLI lib (suggested by @noerw )
  • creating global flags and use append() to merge subcommand flags with global flags (suggested by @techknowlogick )

To compare both options I created a branch in my fork for each of them:

  • Cobra: #27
  • current cli: #26

root360-AndreasUlm avatar May 02 '19 05:05 root360-AndreasUlm

After implementing #26 I found this solution to be easier and the workaround seems to work quite well. The switch to Cobra will take more time.

root360-AndreasUlm avatar May 02 '19 06:05 root360-AndreasUlm

@root360-AndreasUlm I think #26 is easier for review.

lunny avatar May 02 '19 14:05 lunny

@lunny then let's go with #26. I'll close #15 and #27.

root360-AndreasUlm avatar May 02 '19 14:05 root360-AndreasUlm