Comments (8)
Yes, it absolutely would. I initially implemented those that were most commonly used, however there are many more possible argument types to add I believe. There is also a question of positional arguments (see #38 discussion) which could expand into having its own list of types etc.
from argparse.
I think that moving from List to TypeList would make semantics more explicit and
less controversial.
For a few common types - not so mach work, at first glance.
If there is a fear that the number of parameter types or argument types will increase, then it may make sense to separate argument types and data types of their parameters.
For example:
type DataType int
const (
StringType DataType = iota// string - is default
IntType
FloatType
FileType
// et c.
)
func ArgumentSingle(typeToUse DataType,...) DataType{...}
func ArgumentsList(typeToUse DataType,...) DataType{...}
func ArgumentsN(typeToUse DataType,...) DataType{...}
func ArgumentsFinalList(typeToUse DataType,...) DataType{...}
//et c.
or maybe even better:
func (typeToUse DataType) ArgumentSingle(...) DataType{...}
//--//--
But this approach will be ... harder to implement. What can I say.
As for ease of use, I donβt know ... on the one hand, it is necessary to print an additional parameter each time an argument is generated, on the other hand, the number of combinations drops sharply.
from argparse.
I don't think the number of methods is an issue, while number of arguments to methods is. I think separate methods (IntList, FloatList etc) makes more sense here rather than passing type to the methods as an argument (also method should return a specific type of pointer, common method that accept multiple types can only return interface then, which does not really help developer).
I think as with other methods in this library as long as implementation is easy to use -- it will be fine. After all the goal here is to simplify life of developers.
In which case my preference is more towards separate methods for each type (i.e. Int, String for singular + IntList, StringList for lists).
Also for backward compatibility would still need to preserve current List method, which can be an alias to StringList. It can be perhaps removed if/when there would be v2 version of this library.
from argparse.
OK
from argparse.
@goofinator should this be closed now? Or there are still more relevant changes coming?
from argparse.
i think that's all, here. Except some documentation. May be i should append some thing on it in the readme?
from argparse.
Sure
from argparse.
Feel free to close this issue whenever you think it is done.
from argparse.
Related Issues (20)
- How do I make a hidden argument? HOT 1
- enable required for positionals HOT 5
- SelectorList flag HOT 2
- Golang Argparse not picking correct value for multiple flags HOT 1
- Allow parser.ParseKnownArgs(...) HOT 2
- How do you get >=0 positionals? HOT 2
- [BUG] v1.4.0 args does not happened when subcommand exists
- Positional args HOT 2
- Creating commands in a type HOT 1
- Add compatibility with complete library [ bash completions ] HOT 1
- Auto complete subcommands HOT 1
- [bug] Unable to detect if file flag was actually provided? HOT 7
- subparser not implemented HOT 1
- Provide ability to configure helptext maxWidth columns HOT 9
- Getting: import cycle not allowed using the example. HOT 1
- Provide <META> fields and Author Information in usage string HOT 2
- Question about returned parameters (not a bug report) HOT 1
- FlagCounter display unexpectedly HOT 1
- expect File arg to take standard input / output stream as a value HOT 2
- Options.Default should be ignored for Flag HOT 4
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 argparse.