Comments (8)
<img src="https://avatars.githubusercontent.com/u/17034?v=3" align="left" width="48" height="48"hspace="10"> Comment by kevmoo
Added Area-Library, Library-Args, Triaged labels.
from args.
<img src="https://avatars.githubusercontent.com/u/4865287?v=3" align="left" width="48" height="48"hspace="10"> Comment by lrhn
Removed Area-Library label.
Added Area-Pkg label.
from args.
<img src="https://avatars.githubusercontent.com/u/444270?v=3" align="left" width="48" height="48"hspace="10"> Comment by seaneagan
Interesting. Dart used to have an equivalent feature for function arguments, until it was removed by popular demand (issue dart-lang/sdk#9097).
If the default value is calculated like that, then does it make sense to have an explicit default value? Seems like it might make more sense to just explain the default calculation in the help:
, and leave null as the default value, in which case you can tell whether a value was specified since there is no way to pass null from the command line. However for flags, defaultsTo
defaults to false
, not null
, so would need to do defaultsTo: null
for that, haven't tested if that works.
from args.
This comment was originally written by [email protected]
I like having default values for a nice out of the box experience. I ended creating a settings object that takes a map as a source and provides the default values if they're not in the map. Then I merge Platform.environment and ArgResults[] into the map provided to the settings object. There's a bit of friction as ArgResults doesn't implement Map or provide an accessor to a Map view, so I have to loop through the options rather than just using Map.addAll. Any thoughts on why ArgResults doesn't implement map or provide an accessor to a Map view? I think having ArgResults implement Map or provide an accessor to a Map view might make merging configuration sources cleaner.
from args.
<img src="https://avatars.githubusercontent.com/u/3276024?v=3" align="left" width="48" height="48"hspace="10"> Comment by anders-sandholm
Removed Library-Args label.
Added Pkg-Args label.
from args.
<img src="https://avatars.githubusercontent.com/u/46275?v=3" align="left" width="48" height="48"hspace="10"> Comment by munificent
I like having default values for a nice out of the box experience.
Agreed. In particular, default values are shown in the usage information.
Any thoughts on why ArgResults doesn't implement map or provide an accessor to a Map view?
Args is super old so I think the map type was still in flux when I first wrote it. I'll follow up on the other bug for this.
Set owner to @munificent.
Removed Type-Defect label.
Added Type-Enhancement, Started labels.
from args.
<img src="https://avatars.githubusercontent.com/u/46275?v=3" align="left" width="48" height="48"hspace="10"> Comment by munificent
I just pushed arg 0.12.0, which adds a .wasParsed() method to ArgResults.
Added Fixed label.
from args.
This comment was originally written by [email protected]
Excellent. Thank you!
from args.
Related Issues (20)
- Statically typed argument parser (possibly with code generator)? HOT 3
- Add a CommandRunner example HOT 2
- Why is `CommandRunner._usageWithoutDescription` private?
- Promote Command.argResults to be non-nullable HOT 1
- Make allowed options case insensitive
- How to add default command?
- Provide the function to print strings in nice columns
- Standards used in docopt. HOT 2
- [Feature request] Show command alias in usage HOT 3
- Command CommandRunner Platform.executableArguments HOT 3
- use of 'mandatory' options breaks handling of the help flag
- Feature request: parse complete command string to List<String> args HOT 3
- Analogue of '::' GNU getopt extension? HOT 1
- `--` needs to be escaped on Windows HOT 2
- Usage should be able to show additional info for trailing options (rest)
- Setting the mandatory parameter of the addOption function to true has no effect. HOT 1
- `takesArguments` should change the usage text
- Incorrect message in `dart_site --help` HOT 1
- remove nullability from `ArgParser.addFlag({bool? defaultsTo = false})`
- default branch renamed from `master` to `main`
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 args.