google / google/subcommands

No documentation for top level flags

Open
#10 5 comments 1 reaction 0 assignees View on GitHub
Dominant language
Go
Stars
795
Forks
51
PR merge metrics
No merged PRs in 30d

Description

There seems to be facilities for adding top level flags given that you can define them as normal with the flags library and then mark them important with the given functions, but I can't seem to find out how to get the value in a subcommand. For example, if I have the following command:

```
$ foo --verbose bar --frobnicate
```
then I would expect for bar to get the frobnicate flag set true, which I have figured out how to do, but in this case I expect it to also have access to the verbose flag. How can I make sure that bar has access to the top level flags defined outside it's scope? They seem to be available in `topFlags` but I can't figure out how to access that from a subcommand.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.