mirror of
https://github.com/ilyakooo0/optparse-applicative.git
synced 2024-11-30 14:03:28 +03:00
Add completion for commands.
This commit is contained in:
parent
5620a636c6
commit
23cadd1820
@ -37,7 +37,14 @@ bashCompletionQuery parser ws i = case runCompletion compl parser of
|
||||
where
|
||||
list_options = filter is_completion
|
||||
. concat
|
||||
. mapParser (\_ -> map show_name . optionNames . optMain)
|
||||
. mapParser (\_ -> opt_names)
|
||||
|
||||
opt_names opt = case optMain opt of
|
||||
OptReader ns _ -> map show_name ns
|
||||
FlagReader ns _ -> map show_name ns
|
||||
ArgReader _ -> []
|
||||
CmdReader ns _ -> ns
|
||||
|
||||
show_name (OptShort c) = '-':[c]
|
||||
show_name (OptLong name) = "--" ++ name
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user