class Parser

Defined in:

main.cr

Instance Method Summary

Instance Method Detail

def complete(args : Array(String)) #

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.


[View source]
def fatal(*objects) #

[View source]
def info(*objects) #

[View source]
def name #

[View source]
def name=(name : Nil | String) #

[View source]
def on(short : String, long : String, desc : String, &block : String -> ) #

Override on(String, String, String, String ->)


[View source]
def on(flag : String, desc : String, &block : String -> ) #

Override on(String, String, String ->)


[View source]
def on(flag : String, &block : String -> ) #

Add an undocumented flag handler.


[View source]
def perr(*objects) #

[View source]
def puts(*objects) #

[View source]
def quiet=(quiet : Bool | Nil) #

[View source]
def quiet? #

[View source]
def stderr #

[View source]
def stderr=(stderr : IO::FileDescriptor | Nil) #

[View source]
def stdout #

[View source]
def stdout=(stdout : IO::FileDescriptor | Nil) #

[View source]
def verbose=(verbose : Bool | Nil) #

[View source]
def verbose? #

[View source]
def warn(*objects) #

[View source]