Comments (7)
You want something like, some argument
. Have a look at Alternative which the parser is an instance of.
from optparse-applicative.
Thanks – I've tried using some (argument ...)
and (:) <$> argument ... <*> arguments ...
and they both share the same problem. When I invoke the program with the --help
option, the argument parser gobbles it up, and then my program tries to process it rather than displaying help as it should.
from optparse-applicative.
Ah yea, that issue was fixed in arguments
but not argument
. I would like the former to be simply something like many argument
but perhaps that's non-trivial or not possible for some reason? In the mean time you should be able to work around it by having the reader return Nothing
if the argument starts with a hyphen.
from optparse-applicative.
That works – thank you again.
The inconsistent behavior should probably go in a separate issue, so I'm closing this for now.
from optparse-applicative.
The problem here is that arguments
has some special logic to:
- initially ignore arguments starting with '-'
- accept '--'
- accept arguments starting with '-' after '--' is encountered
Given this desired behavior, arguments
cannot simply be implemented as many argument
.
What we can do to make common use cases like the one in this Issue easier to
deal with, is to add a bunch of convenience builders, like:
arguments1
, non-empty argument list, with the same behavior asarguments
argument'
, parse 1 argument, ignoring things starting with '-'
This way, many argument'
would be similar to arguments
(without the special
handling of --
), and some argument'
to arguments1
.
Suggestions for better names are welcome. :)
from optparse-applicative.
Fixed by 700e07b,
from optparse-applicative.
I'm sort of pondering if this should happen at a lower level, splitting the input before parsing?
from optparse-applicative.
Related Issues (20)
- URL completer? HOT 6
- Support for parsing RawFilePath HOT 1
- Showing help on empty with inline subcommands HOT 6
- Listification (like `some1`) does not change the `metavar` to plural HOT 2
- Add ability to group aliases in --help HOT 2
- Offer a positional parser HOT 2
- Parse in interactive program HOT 2
- Export `requote` from `Options.Applicative.Builder.Completer` HOT 2
- Options shown in Global section can include unreachable alternatives. HOT 4
- Add Semigroup/Monoid to Parser HOT 7
- Ignore unused flags HOT 2
- Parser HOT 1
- (Question) Is there value in storing CLI output in a text file and using it as a golden test? HOT 1
- Is it possible to automatically show in help which values are valid for an option? HOT 3
- Stack executable built against `optparse-applicative-0.17.1.0` 'hangs' HOT 20
- Ansi annotations aren't being rendered.
- How do I print help info with colored command names? HOT 14
- v0.18: `text` no longer exported from `Options.Applicative.Help.Pretty` HOT 4
- Default command and command alias
- Apply style for command groups HOT 3
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 optparse-applicative.