class Parser
- Parser
- OptionParser
- Reference
- Object
Defined in:
main.crInstance Method Summary
-
#complete(args : Array(String))
Given an array of 3 words, containing
- #fatal(*objects)
- #info(*objects)
- #name
- #name=(name : Nil | String)
-
#on(short : String, long : String, desc : String, &block : String -> )
Override on(String, String, String, String ->)
-
#on(flag : String, desc : String, &block : String -> )
Override on(String, String, String ->)
-
#on(flag : String, &block : String -> )
Add an undocumented flag handler.
- #perr(*objects)
- #puts(*objects)
- #quiet=(quiet : Bool | Nil)
- #quiet?
- #stderr
- #stderr=(stderr : IO::FileDescriptor | Nil)
- #stdout
- #stdout=(stdout : IO::FileDescriptor | Nil)
- #verbose=(verbose : Bool | Nil)
- #verbose?
- #warn(*objects)
Instance Method Detail
Given an array of 3 words, containing
- a program name
- a partially completed word
- the last fully completed word
this method prints out, one per line, the next words which are allowed by this OptionParser.
This is a basic Bash-style command-line completion helper. See your
shell's help complete
and the manual for details. It will be invoked by
bash if you set complete -C toolbelt toolbelt
, for example, which says
"whenever I try to complete a word after 'toolbelt', call 'toolbelt' with
certain environment variables set". (The function uses $COMP_LINE
, so
you can test your completion by invoking the program with that variable
set - see bash(1) for details.)
TODO allow flag values and arguments to be completed also.
TODO this uses an internal variable (@handlers) which seems risky. It might be better to copy the implementation and add a more stable API.
Override on(String, String, String, String ->)