Commit Graph

675 Commits

Author SHA1 Message Date
Huw Campbell
7cf432d567 Allow treeMapParser to see through a bind parser.
We need to do this in order to have bash completion work for
many and some arguments. Such as if we're doing a ls like
program and want to complete on all of the arguments.

This might actually be a regression from 0.13.0.
2017-03-29 17:35:36 +11:00
Huw Campbell
018de66727 Add fish shell completion generator 2017-03-29 15:24:14 +11:00
Huw Campbell
6b1a91b41b Eliminate common expressions 2017-03-29 09:29:38 +11:00
Huw Campbell
bfe7a02c26 Better strong quote escaping 2017-03-28 20:29:10 +11:00
Huw Campbell
f126e188e6 Explicitly handle double quoted strings 2017-03-28 20:06:05 +11:00
Huw Campbell
29ae9c3519 Fixup escaping when running compgen. 2017-03-28 17:26:52 +11:00
Huw Campbell
2ca2e719df Have README example not require Control.Monad 2017-03-28 10:06:54 +11:00
Huw Campbell
5cbd039ff6 Add type sig in test 2017-03-27 16:00:42 +11:00
Huw Campbell
fd74e8221e Merge pull request #223 from pcapriotti/topic/polymorphic-str
Rewrite str, eitherReader and maybeReader to be polymorphic over IsSt…
2017-03-27 15:43:18 +11:00
Huw Campbell
ddcd183dbc Rewrite str, eitherReader and maybeReader to be polymorphic over IsString.
This has significant benefits, in that it covers off Text and ByteString
readers for free (and without dependencies) and works pretty seamlessly
with Attoparsec parsers.

May cause breakages if people are using str for type inference.
In that case, adding type signatures should fix the problem.
2017-03-27 15:33:26 +11:00
Huw Campbell
049514adcd Merge pull request #253 from pcapriotti/topic/description-modifier
Add a new modifier for editing an option description
2017-03-27 15:32:24 +11:00
Huw Campbell
7ebb34bd32 Add a new modifier for editing/styling an option description
iven a `Doc -> Doc` function, this modifier will apply it to
the option description (names and metavar). Suggested usage is
`bold` or the like, but one can use any function, including
`const`.
2017-03-27 15:32:00 +11:00
Huw Campbell
1a431cf984 Add more categories to cabal file 2017-03-27 14:44:14 +11:00
Huw Campbell
cea345c4af Use common function for showing OptName 2017-03-27 14:44:10 +11:00
Huw Campbell
88a96be5ee Merge pull request #254 from pcapriotti/topic/option-expects-msg
Add an error message for options which require arguments
2017-03-27 14:11:46 +11:00
Huw Campbell
9c72eb9853 Add an error message for when the user does not supply an argument to an option
We can push the option name supplied into the construction of the
error message. This cleans up the `ExpectsArgError` type, while
keeping essentially all English text in one place, and allows
a user to customise this message better.

We can keep the builder API the same though using const.
2017-03-27 13:24:14 +11:00
Huw Campbell
4c63d925ac Better imports for Help 2017-03-12 17:45:40 +11:00
Huw Campbell
f72fada043 Merge pull request #248 from pcapriotti/topic/0.13.2-hotfix
Topic/0.13.2 hotfix
2017-03-09 12:05:28 +11:00
Huw Campbell
8ff5a354dd Update changelog and version 2017-03-09 11:44:00 +11:00
Huw Campbell
f7d3020a18 Bump process again 2017-03-09 11:44:00 +11:00
Huw Campbell
7322a610ab Remove example from cabal file
Fixup haddocks for Help
2017-03-09 11:43:57 +11:00
Huw Campbell
9fd2fc71e7 Merge pull request #247 from pcapriotti/topic/flags-with-opts
Guard on Flags for long opts with '=val'
2017-03-08 20:57:15 +11:00
Huw Campbell
4433286536 Guard on Flags for long opts with '=val' 2017-03-08 20:50:26 +11:00
Huw Campbell
bbad8fc1b5 Merge pull request #244 from pcapriotti/topic/levenshtein
Add suggestions for typos
2017-03-08 20:04:34 +11:00
Huw Campbell
6ea4658def Formatting 2017-03-08 19:30:56 +11:00
Huw Campbell
d9df779685 Additional completions test 2017-03-08 19:30:56 +11:00
Huw Campbell
38b105e027 Escape newline correctly in bash completion script 2017-03-08 19:30:56 +11:00
Huw Campbell
f66ff9b083 Put suggestions into their own ParserHelp record.
This would allow one to either delete them or not
show things like usage if there is a suggestion.
2017-03-08 19:30:56 +11:00
Huw Campbell
7f292eba34 Add a test for suggestions 2017-03-08 19:30:56 +11:00
Huw Campbell
5c48137480 Add suggestions for typos
Uses a Levenshtein distance to see if there's a suitable
candidate for suggestions.

Also fixes a subtle bug in bash completions, where argument
completers from deeper into the parser would have their
possibilities added to the completion.
2017-03-08 19:30:56 +11:00
Huw Campbell
5774bad598 Merge pull request #234 from pcapriotti/topic/no-intersperse
Fix noIntersperse behaviour, and add a new policy
2017-03-08 19:28:29 +11:00
Huw Campbell
2238006cff Rename constructors for ArgPolicy 2017-02-27 08:42:56 +11:00
Huw Campbell
37a4ee1a60 Better description in haddocks 2017-02-26 18:32:40 +11:00
Huw Campbell
a675abe418 Fix noIntersperse behaviour, and add new policies.
noInterpserse was not allowing any options to occur
before arguments, and wasn't behaving as its namesake
in other parsing libraries.

Add a new policy (which is potentially useful for
applications wrapping other cli tools) allowing the
command (or subcommand) to collect all unknown options
and arguments as positionals to be passed to the
command line.
2017-02-24 19:36:29 +11:00
Huw Campbell
e485619829 Merge pull request #240 from pcapriotti/topic/prepare-0.13.1
Bump version
2017-02-10 17:18:04 +11:00
Huw Campbell
5380805621 Remove version example from the README
It's not best way to make a version command
2017-02-09 19:39:48 +11:00
Huw Campbell
1a89185ca3 Have badge reflect only the master build status 2017-02-09 19:38:23 +11:00
Huw Campbell
7ee1b9ad6b Bump version
Add Huw Campbell to authors list
2017-02-09 19:38:23 +11:00
Huw Campbell
28afb18baa Merge pull request #241 from bgamari/patch-1
Bump upper bound on process
2017-02-09 16:14:55 +11:00
Ben Gamari
c47363b8b0 Bump upper bound on process 2017-02-08 23:55:58 -05:00
Huw Campbell
b09ddb7416 Fix type signature in Readme. 2017-02-05 08:31:04 +11:00
Huw Campbell
50b8efd3d8 Update README.md 2017-02-03 13:33:25 +11:00
Huw Campbell
7d0543579d Update README.md
Simpler first sentence.
2017-02-03 11:54:28 +11:00
Huw Campbell
d762c96d91 Merge pull request #237 from pcapriotti/topic/doc
Topic/doc
2017-02-03 11:43:12 +11:00
Huw Campbell
81465b04a0 Use backticks on command line input 2017-02-03 10:50:47 +11:00
Huw Campbell
7438a0fadf Run through gnu fmt 2017-02-03 10:50:44 +11:00
Huw Campbell
a122b646ad Explain one common misusage pattern 2017-02-03 10:14:59 +11:00
Huw Campbell
54cb2923ea Take in Feedback on README 2017-02-03 10:14:04 +11:00
Huw Campbell
6fd4244fd3 More haddocks 2017-01-03 14:40:36 +08:00
Huw Campbell
c050e30495 Style 2016-12-01 22:04:13 +11:00