Command

Library for parsing command-line arguments.


Source: pkg/lua/lib/cmd.go | Import: cmd

Cannot be used when the workflow was called from the workflow selection menu.

Functions


parse

parse() -> bool, string

Return Values

  • bool - If the results are valid.
  • string - A string of the error if on occured.
called

called() -> bool

Return Values

  • bool - If the workflow was called directly from the command-line.
options

options() -> struct<cmd.Options>

Creates a table for passing options into arguments.

Return Values

  • struct<cmd.Options>
arg_flag

arg_flag(short, long, options?) -> int<ref.BOOL>

Arguments

  • short string
  • long string
  • options struct<cmd.Options>
Return Values

  • int<ref.BOOL>
arg_flag_count

arg_flag_count(short, long, options?) -> int<ref.INT>

Arguments

  • short string
  • long string
  • options struct<cmd.Options>
Return Values

  • int<ref.INT>
arg_string

arg_string(short, long, options?) -> int<ref.STRING>

Arguments

  • short string
  • long string
  • options struct<cmd.Options>
Return Values

  • int<ref.STRING>
arg_string_list

arg_string_list(short, long, options?) -> int<[]ref.STRING>

Arguments

  • short string
  • long string
  • options struct<cmd.Options>
Return Values

  • int<[]ref.STRING>
arg_string_pos

arg_string_pos(options?) -> int<ref.STRING>

Arguments

  • options struct<cmd.Options>
Return Values

  • int<ref.STRING>
arg_int

arg_int(short, long, options?) -> int<ref.INT>

Arguments

  • short string
  • long string
  • options struct<cmd.Options>
Return Values

  • int<ref.INT>
arg_int_list

arg_int_list(short, long, options?) -> int<[]ref.INT>

Arguments

  • short string
  • long string
  • options struct<cmd.Options>
Return Values

  • int<[]ref.INT>
arg_int_pos

arg_int_pos(options?) -> int<ref.INT>

Arguments

  • options struct<cmd.Options>
Return Values

  • int<ref.INT>
arg_float

arg_float(short, long, options?) -> int<ref.FLOAT>

Arguments

  • short string
  • long string
  • options struct<cmd.Options>
Return Values

  • int<ref.FLOAT>
arg_float_list

arg_float_list(short, long, options?) -> int<[]ref.FLOAT>

Arguments

  • short string
  • long string
  • options struct<cmd.Options>
Return Values

  • int<[]ref.FLOAT>
arg_float_pos

arg_float_pos(options?) -> int<[]ref.FLOAT>

Arguments

  • options struct<cmd.Options>
Return Values

  • int<[]ref.FLOAT>
arg_selector

arg_selector(short, long, choices, options?) -> int<ref.STRING>

Arguments

  • short string
  • long string
  • choices []string
  • options struct<cmd.Options>
Return Values

  • int<ref.STRING>
arg_selector_pos

arg_selector_pos(choices, options?) -> int<ref.STRING>

Arguments

  • choices []string
  • options struct<cmd.Options>
Return Values

  • int<ref.STRING>

Constants


DefaultType
  • DEFAULT_INT
  • DEFAULT_FLOAT
  • DEFAULT_STRING
  • DEFAULT_BOOL

Structs


Options

Methods

required

required(bool) -> self

validate

validate({function([]string) -> string}) -> self


Takes in all values for the argument, and returns an error if there was one. Use an empty string for when there is no error.

default

default(any, int<cmd.DefaultType>) -> self


The first value should match the default type given.