Comments (5)
This is only true for option groups, but not for commands. I'm not really seeing any issue with nicely separating your options in the ini file in the structure of option groups. If you don't like the default option group name, then you can use flags.NewNamedParser and add an option group to it manually, with another name.
from go-flags.
Why would I have the same named command in two groups? Heck, I don't even really see the need for groups, at least in my case. Yes I can add the header because I know about it, but my users will not. I'm trying to lower the bar of complexity for them. Most programs that take ini/conf files do not contain or use headers. The only popular example I can think of that does is php.ini, and the headers are optional.
from go-flags.
I guess you misunderstood. Sections in ini files can be used to specify the options of a command. Multiple commands can have the same options (and a command can have the same flag as the global flags), so in that case you will need to use a section in the ini file.
The support for ini files is really meant/written as a convenience, and not as an integral part of go-flags. If you need something that works differently, then you can use your own config parser to fill in the struct fields.
Finally, with regard to not specifying a group header, I guess I'm fine with having options without a section in the ini file, and have those being mapped to any group at the toplevel of the parser. It's easy to implement.
from go-flags.
Oh, ok. Yeah I did misunderstand that. An option like that would be good, thank you for considering it.
from go-flags.
This should be fixed now. Options specified in the global section (i.e. no section specified) will be matched against all toplevel groups, in order in which those groups are defined. Feel free to reopen the issue if you still encounter problems.
from go-flags.
Related Issues (20)
- Allow to specify default value for a positional argument
- Add a working completion example for 'zsh' shell
- Add a man generator for markup (ronn-style)
- Need proper documentation on how to correctly handle errors HOT 13
- Can flags be used to parse command line arguments from 'go test' ? HOT 2
- Is this an abandoned project?
- Is this an abandoned project? HOT 21
- Program description
- A little leverage
- help format default posix in windows, I don't want to use -tags=forceposix, let them use -tags=forcewindows HOT 2
- Fix CVE-2022-29526 vulnerability caused by golang.org/x/sys? HOT 2
- How to group subcommands HOT 3
- Is it possible to have dynamically generated help descriptions?
- Passing options as argument to other options without using positional-args HOT 1
- custom type positional argument ValueValidator implementation is ignored
- How do I add a flag and pass the value there?
- Multiple short options are not detected with `IgnoreUnknown` flag.
- Support unicode chars in WriteHelp
- Manage unset flag/environment variable HOT 3
- group.go mixed left quote (`) with single quote (') HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-flags.