abstract class LuckyTask::Task
- LuckyTask::Task
- Reference
- Object
Defined in:
lucky_task/task.crInstance Method Summary
Macro Summary
-
arg(arg_name, description, shortcut = nil, optional = false, format = nil, example = nil)
Creates a method of
arg_name
that returns the value passed in from the CLI. -
name(name_text)
Sets a custom title for the task
-
positional_arg(arg_name, description, to_end = false, format = nil, example = nil)
Creates a method of
arg_name
that returns the value passed in from the CLI. - summary(summary_text)
-
switch(arg_name, description, shortcut = nil)
Creates a method of
arg_name
where the return value is boolean.
Instance Method Detail
Macro Detail
Creates a method of arg_name
that returns the value passed in from the CLI.
The CLI arg is specified by the --arg_name=VALUE
flag.
arg_name
: String - The name of the argumentdescription
: String - The help text description for this optionshorcut
: String - An optional short flag (e.g. -a VALUE)optional
: Bool - When false, raise exception if this arg is not passedformat
: Regex - The format you expect the args to matchexample
: String - An example string that matches the givenformat
Sets a custom title for the task
By default the name is derived from the full module and class name. However if that name is not desired, a custom one can be set.
class Dev::Prime < LuckyTask::Task
# Would be "dev.prime" by default, but we want to set it to "dev.setup":
name "dev.setup"
summary "Seed the development database with example data"
# other methods, etc.
end
Creates a method of arg_name
that returns the value passed in from the CLI.
The CLI arg position is based on the order in which positional_arg
is specified
with the first call being position 0, and so on.
If your arg takes more than one value, you can set to_end
to true to capture all
args from this position to the end. This will make your arg_name
method return Array(String)
.
arg_name
: String - The name of the argumentdescription
: String - The help text description for this optionto_end
: Bool - Capture all args from this position to the end.format
: Regex - The format you expect the args to matchexample
: String - An example string that matches the givenformat
Creates a method of arg_name
where the return value is boolean.
If the flag --arg_name
is passed, the value is true
.
arg_name
: String - The name of the argumentdescription
: String - The help text description for this optionshorcut
: String - An optional short flag (e.g.-a
)