)\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [matthewmcgarvey](https://github.com/matthewmcgarvey) - creator and maintainer\n","program":{"html_id":"lucky_task/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"locations":[],"repository_name":"lucky_task","program":true,"enum":false,"alias":false,"const":false,"types":[{"html_id":"lucky_task/LuckyTask","path":"LuckyTask.html","kind":"module","full_name":"LuckyTask","name":"LuckyTask","abstract":false,"locations":[{"filename":"src/lucky_task.cr","line_number":5,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task.cr#L5"},{"filename":"src/lucky_task/text_helpers.cr","line_number":1,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/text_helpers.cr#L1"}],"repository_name":"lucky_task","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"VERSION","name":"VERSION","value":"\"0.2.0\""}],"types":[{"html_id":"lucky_task/LuckyTask/Runner","path":"LuckyTask/Runner.html","kind":"class","full_name":"LuckyTask::Runner","name":"Runner","abstract":false,"superclass":{"html_id":"lucky_task/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"lucky_task/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"lucky_task/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/lucky_task/runner.cr","line_number":1,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/runner.cr#L1"}],"repository_name":"lucky_task","program":false,"enum":false,"alias":false,"const":false,"extended_modules":[{"html_id":"lucky_task/LuckyTask/TextHelpers","kind":"module","full_name":"LuckyTask::TextHelpers","name":"TextHelpers"}],"namespace":{"html_id":"lucky_task/LuckyTask","kind":"module","full_name":"LuckyTask","name":"LuckyTask"},"class_methods":[{"html_id":"exit_with_error_if_not_found=(exit_with_error_if_not_found:Bool)-class-method","name":"exit_with_error_if_not_found=","abstract":false,"args":[{"name":"exit_with_error_if_not_found","external_name":"exit_with_error_if_not_found","restriction":"Bool"}],"args_string":"(exit_with_error_if_not_found : Bool)","args_html":"(exit_with_error_if_not_found : Bool)","location":{"filename":"src/lucky_task/runner.cr","line_number":3,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/runner.cr#L3"},"def":{"name":"exit_with_error_if_not_found=","args":[{"name":"exit_with_error_if_not_found","external_name":"exit_with_error_if_not_found","restriction":"Bool"}],"visibility":"Public","body":"@@exit_with_error_if_not_found = exit_with_error_if_not_found"}},{"html_id":"exit_with_error_if_not_found?:Bool-class-method","name":"exit_with_error_if_not_found?","abstract":false,"location":{"filename":"src/lucky_task/runner.cr","line_number":3,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/runner.cr#L3"},"def":{"name":"exit_with_error_if_not_found?","return_type":"Bool","visibility":"Public","body":"@@exit_with_error_if_not_found"}},{"html_id":"find_task(task_name:String):LuckyTask::Task|Nil-class-method","name":"find_task","abstract":false,"args":[{"name":"task_name","external_name":"task_name","restriction":"String"}],"args_string":"(task_name : String) : LuckyTask::Task | Nil","args_html":"(task_name : String) : LuckyTask::Task | Nil","location":{"filename":"src/lucky_task/runner.cr","line_number":49,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/runner.cr#L49"},"def":{"name":"find_task","args":[{"name":"task_name","external_name":"task_name","restriction":"String"}],"return_type":"LuckyTask::Task | ::Nil","visibility":"Public","body":"found_task = @@tasks.find do |task|\n task.task_name == task_name\nend\nif found_task\n found_task.new\nend\n"}},{"html_id":"help_text:Nil-class-method","name":"help_text","abstract":false,"location":{"filename":"src/lucky_task/runner.cr","line_number":39,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/runner.cr#L39"},"def":{"name":"help_text","return_type":"Nil","visibility":"Public","body":"puts(\"Usage: lucky name.of.task [options]\\n\\nAvailable tasks:\\n\\n#{tasks_list}\")"}},{"html_id":"list_padding_for(task_name):String-class-method","name":"list_padding_for","abstract":false,"args":[{"name":"task_name","external_name":"task_name","restriction":""}],"args_string":"(task_name) : String","args_html":"(task_name) : String","location":{"filename":"src/lucky_task/runner.cr","line_number":67,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/runner.cr#L67"},"def":{"name":"list_padding_for","args":[{"name":"task_name","external_name":"task_name","restriction":""}],"return_type":"String","visibility":"Public","body":"\" \" * ((longest_task_name - task_name.size) + 2)"}},{"html_id":"longest_task_name:Int32-class-method","name":"longest_task_name","abstract":false,"location":{"filename":"src/lucky_task/runner.cr","line_number":71,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/runner.cr#L71"},"def":{"name":"longest_task_name","return_type":"Int32","visibility":"Public","body":"tasks.max_of() do |__arg1|\n __arg1.task_name.size\nend"}},{"html_id":"register_task(task:LuckyTask::Task.class):Nil-class-method","name":"register_task","abstract":false,"args":[{"name":"task","external_name":"task","restriction":"LuckyTask::Task.class"}],"args_string":"(task : LuckyTask::Task.class) : Nil","args_html":"(task : LuckyTask::Task.class) : Nil","location":{"filename":"src/lucky_task/runner.cr","line_number":7,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/runner.cr#L7"},"def":{"name":"register_task","args":[{"name":"task","external_name":"task","restriction":"LuckyTask::Task.class"}],"return_type":"Nil","visibility":"Public","body":"@@tasks.push(task)"}},{"html_id":"run(args=ARGV,io:IO=STDERR)-class-method","name":"run","abstract":false,"args":[{"name":"args","default_value":"ARGV","external_name":"args","restriction":""},{"name":"io","default_value":"STDERR","external_name":"io","restriction":"IO"}],"args_string":"(args = ARGV, io : IO = STDERR)","args_html":"(args = ARGV, io : IO = STDERR)","location":{"filename":"src/lucky_task/runner.cr","line_number":15,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/runner.cr#L15"},"def":{"name":"run","args":[{"name":"args","default_value":"ARGV","external_name":"args","restriction":""},{"name":"io","default_value":"STDERR","external_name":"io","restriction":"IO"}],"visibility":"Public","body":"task_name = args.shift?\nif (!task_name.nil?) && ({\"--help\", \"-h\"}.includes?(task_name))\n puts(help_text)\nelse\n if task_name.nil?\n io.puts(\"Missing a task name\\n\\nTo see a list of available tasks, run #{\"lucky tasks\".colorize(:green)}\")\n else\n if task = find_task(task_name)\n task.output = io\n task.print_help_or_call(args)\n else\n TaskNotFoundErrorMessage.print(task_name)\n if exit_with_error_if_not_found?\n exit(127)\n end\n end\n end\nend\n"}},{"html_id":"tasks:Array(LuckyTask::Task.class)-class-method","name":"tasks","abstract":false,"location":{"filename":"src/lucky_task/runner.cr","line_number":11,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/runner.cr#L11"},"def":{"name":"tasks","return_type":"Array(LuckyTask::Task.class)","visibility":"Public","body":"@@tasks.sort_by!(&.task_name)"}},{"html_id":"tasks_list:String-class-method","name":"tasks_list","abstract":false,"location":{"filename":"src/lucky_task/runner.cr","line_number":56,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/runner.cr#L56"},"def":{"name":"tasks_list","return_type":"String","visibility":"Public","body":"String.build do |list|\n tasks.each do |task|\n list << ((\" #{arrow} \" + task.task_name).colorize(:green))\n list << (list_padding_for(task.task_name))\n list << task.task_summary\n list << \"\\n\"\n end\nend"}}]},{"html_id":"lucky_task/LuckyTask/Task","path":"LuckyTask/Task.html","kind":"class","full_name":"LuckyTask::Task","name":"Task","abstract":true,"superclass":{"html_id":"lucky_task/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"lucky_task/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"lucky_task/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/lucky_task/task.cr","line_number":1,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/task.cr#L1"}],"repository_name":"lucky_task","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"lucky_task/LuckyTask","kind":"module","full_name":"LuckyTask","name":"LuckyTask"},"instance_methods":[{"html_id":"call-instance-method","name":"call","abstract":true,"location":{"filename":"src/lucky_task/task.cr","line_number":295,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/task.cr#L295"},"def":{"name":"call","visibility":"Public","body":""}}],"macros":[{"html_id":"arg(arg_name,description,shortcut=nil,optional=false,format=nil,example=nil)-macro","name":"arg","doc":"Creates a method of `arg_name` that returns the value passed in from the CLI.\nThe CLI arg is specified by the `--arg_name=VALUE` flag.\n\n* `arg_name` : String - The name of the argument\n* `description` : String - The help text description for this option\n* `shorcut` : String - An optional short flag (e.g. -a VALUE)\n* `optional` : Bool - When false, raise exception if this arg is not passed\n* `format` : Regex - The format you expect the args to match\n* `example` : String - An example string that matches the given `format`","summary":"Creates a method of arg_name
that returns the value passed in from the CLI.
","abstract":false,"args":[{"name":"arg_name","external_name":"arg_name","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"shortcut","default_value":"nil","external_name":"shortcut","restriction":""},{"name":"optional","default_value":"false","external_name":"optional","restriction":""},{"name":"format","default_value":"nil","external_name":"format","restriction":""},{"name":"example","default_value":"nil","external_name":"example","restriction":""}],"args_string":"(arg_name, description, shortcut = nil, optional = false, format = nil, example = nil)","args_html":"(arg_name, description, shortcut = nil, optional = false, format = nil, example = nil)","location":{"filename":"src/lucky_task/task.cr","line_number":152,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/task.cr#L152"},"def":{"name":"arg","args":[{"name":"arg_name","external_name":"arg_name","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"shortcut","default_value":"nil","external_name":"shortcut","restriction":""},{"name":"optional","default_value":"false","external_name":"optional","restriction":""},{"name":"format","default_value":"nil","external_name":"format","restriction":""},{"name":"example","default_value":"nil","external_name":"example","restriction":""}],"visibility":"Public","body":" \n{% PARSER_OPTS << arg_name %}\n\n @\n{{ arg_name.id }}\n : String?\n\n def set_opt_for_\n{{ arg_name.id }}\n(unused_args : Array(String))\n option_parser.on(\n \n{% if shortcut %}\"{{ shortcut.id }} {{ arg_name.stringify.upcase.id }}\",{% end %}\n\n \"--\n{{ (arg_name.id.stringify.underscore.gsub(/_/, \"-\")).id }}\n=\n{{ arg_name.id.stringify.upcase.id }}\n\",\n \n{{ description }}\n\n ) do |value|\n value = value.strip\n \n{% if format %}\n if value !~ {{ format }}\n raise <<-ERROR\n Invalid format for {{ arg_name.id }}. It should match {{ format }}\n {% if example %}\n Example: {{ example.id }}\n {% end %}\n ERROR\n end\n {% end %}\n\n @\n{{ arg_name.id }}\n = value\n \nend\n \nend\n\n def \n{{ arg_name.id }}\n : String\n{% if optional %}?{% end %}\n\n \n{% if !optional %}\n if @{{ arg_name.id }}.nil?\n raise <<-ERROR\n {{ arg_name.id }} is required, but no value was passed.\n\n Try this...\n\n {% if shortcut %}{{ shortcut.id }} SOME_VALUE{% end %}\n --{{ (arg_name.id.stringify.underscore.gsub(/_/, \"-\")).id }}=SOME_VALUE\n ERROR\n end\n @{{ arg_name.id }}.as(String)\n {% else %}\n @{{ arg_name.id }}\n {% end %}\n\n \nend\n \n"}},{"html_id":"float64(arg_name,description,shortcut=nil,default=nil)-macro","name":"float64","doc":"Creates a method of `arg_name` where the return value is an Float64.\nIf the flag `--arg_name` is passed, the result is the value passed, otherwise is set to\nthe specified default, or `0.0` when not specified.\n\n* `arg_name` : String - The name of the argument\n* `description` : String - The help text description for this option\n* `shorcut` : String - An optional short flag (e.g. `-a`)\n* `default` : Float64 - An optional default value (`0.0` is default when omittted)\n\nExample:\n float64 :threshold, \"(0.1, 3.14, -5.1, etc.)\", shortcut: \"-t\", default: 2.0","summary":"Creates a method of arg_name
where the return value is an Float64.
","abstract":false,"args":[{"name":"arg_name","external_name":"arg_name","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"shortcut","default_value":"nil","external_name":"shortcut","restriction":""},{"name":"default","default_value":"nil","external_name":"default","restriction":""}],"args_string":"(arg_name, description, shortcut = nil, default = nil)","args_html":"(arg_name, description, shortcut = nil, default = nil)","location":{"filename":"src/lucky_task/task.cr","line_number":269,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/task.cr#L269"},"def":{"name":"float64","args":[{"name":"arg_name","external_name":"arg_name","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"shortcut","default_value":"nil","external_name":"shortcut","restriction":""},{"name":"default","default_value":"nil","external_name":"default","restriction":""}],"visibility":"Public","body":" \n{% PARSER_OPTS << arg_name %}\n\n @\n{{ arg_name.id }}\n : Float64 = \n{{ default || 0.0 }}\n\n\n def set_opt_for_\n{{ arg_name.id }}\n(unused_args : Array(String))\n option_parser.on(\n \n{% if shortcut %}\"{{ shortcut.id }} {{ arg_name.stringify.upcase.id }}\",{% end %}\n\n \"--\n{{ (arg_name.id.stringify.underscore.gsub(/_/, \"-\")).id }}\n=\n{{ arg_name.id.stringify.upcase.id }}\n\",\n \n{{ description }}\n\n ) do |value|\n value = value.strip.gsub(\"_\", \"\")\n if value !~ /^[+-]?([0-9]*[.])?[0-9]+$/\n raise <<-ERROR\n #{value.inspect} is an invalid value for \n{{ arg_name.id }}\n. It should be a valid Float64\n Examples: 1 or 1.0 or 1_000.0 or -1.0\n ERROR\n \nend\n @\n{{ arg_name.id }}\n = value.to_f64\n \nend\n \nend\n\n def \n{{ arg_name.id }}\n : Float64\n @\n{{ arg_name.id }}\n\n \nend\n \n"}},{"html_id":"help_message(help_text)-macro","name":"help_message","doc":"Customize your help message with the provided `help_text`\n\n```\nclass KeyGen < LuckyTask::Task\n summary \"Generate a new key\"\n help_message \"Call lucky key_gen to generate a new key\"\n\n # other methods, etc.\nend\n```","summary":"Customize your help message with the provided help_text
","abstract":false,"args":[{"name":"help_text","external_name":"help_text","restriction":""}],"args_string":"(help_text)","args_html":"(help_text)","location":{"filename":"src/lucky_task/task.cr","line_number":92,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/task.cr#L92"},"def":{"name":"help_message","args":[{"name":"help_text","external_name":"help_text","restriction":""}],"visibility":"Public","body":" def self.task_help_message : String\n \n{{ help_text }}\n\n \nend\n \n"}},{"html_id":"int32(arg_name,description,shortcut=nil,default=nil)-macro","name":"int32","doc":"Creates a method of `arg_name` where the return value is an Int32.\nIf the flag `--arg_name` is passed, the result is the value passed, otherwise is set to\nthe specified default, or `0` when not specified.\n\n* `arg_name` : String - The name of the argument\n* `description` : String - The help text description for this option\n* `shorcut` : String - An optional short flag (e.g. `-a`)\n* `default` : Int32 - An optional default value (`0` is default when omittted)\n\nExample:\n int32 :limit, \"limit (1000, 10_000, etc.)\", shortcut: \"-l\", default: 1_000","summary":"Creates a method of arg_name
where the return value is an Int32.
","abstract":false,"args":[{"name":"arg_name","external_name":"arg_name","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"shortcut","default_value":"nil","external_name":"shortcut","restriction":""},{"name":"default","default_value":"nil","external_name":"default","restriction":""}],"args_string":"(arg_name, description, shortcut = nil, default = nil)","args_html":"(arg_name, description, shortcut = nil, default = nil)","location":{"filename":"src/lucky_task/task.cr","line_number":232,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/task.cr#L232"},"def":{"name":"int32","args":[{"name":"arg_name","external_name":"arg_name","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"shortcut","default_value":"nil","external_name":"shortcut","restriction":""},{"name":"default","default_value":"nil","external_name":"default","restriction":""}],"visibility":"Public","body":" \n{% PARSER_OPTS << arg_name %}\n\n @\n{{ arg_name.id }}\n : Int32 = \n{{ default || 0 }}\n\n\n def set_opt_for_\n{{ arg_name.id }}\n(unused_args : Array(String))\n option_parser.on(\n \n{% if shortcut %}\"{{ shortcut.id }} {{ arg_name.stringify.upcase.id }}\",{% end %}\n\n \"--\n{{ (arg_name.id.stringify.underscore.gsub(/_/, \"-\")).id }}\n=\n{{ arg_name.id.stringify.upcase.id }}\n\",\n \n{{ description }}\n\n ) do |value|\n value = value.strip\n if value !~ /^[\\+\\-]?[0-9\\_]+$/\n raise <<-ERROR\n #{value.inspect} is an invalid value for \n{{ arg_name.id }}\n. It should be a valid Int32\n Examples: 1 or 1000 or 10_000 or -1\n ERROR\n \nend\n @\n{{ arg_name.id }}\n = value.gsub(/[\\_]/, \"\").to_i32\n \nend\n \nend\n\n def \n{{ arg_name.id }}\n : Int32\n @\n{{ arg_name.id }}\n\n \nend\n \n"}},{"html_id":"name(name_text)-macro","name":"name","doc":"Renames the task name for CLI use\n\nBy default the task name is derived from the full module and class name.\nHowever if that task name is not desired, a custom one can be set.\n\n```\nclass Dev::Prime < LuckyTask::Task\n # Would be \"dev.prime\" by default, but we want to set it to \"dev.setup\":\n task_name \"dev.setup\"\n summary \"Seed the development database with example data\"\n\n # other methods, etc.\nend\n```","summary":"Renames the task name for CLI use
","abstract":false,"args":[{"name":"name_text","external_name":"name_text","restriction":""}],"args_string":"(name_text)","args_html":"(name_text)","location":{"filename":"src/lucky_task/task.cr","line_number":76,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/task.cr#L76"},"def":{"name":"name","args":[{"name":"name_text","external_name":"name_text","restriction":""}],"visibility":"Public","body":" def self.task_name : String\n \n{{ name_text }}\n\n \nend\n \n"}},{"html_id":"positional_arg(arg_name,description,to_end=false,format=nil,example=nil)-macro","name":"positional_arg","doc":"Creates a method of `arg_name` that returns the value passed in from the CLI.\nThe CLI arg position is based on the order in which `positional_arg` is specified\nwith the first call being position 0, and so on.\n\nIf your arg takes more than one value, you can set `to_end` to true to capture all\nargs from this position to the end. This will make your `arg_name` method return `Array(String)`.\n\n* `arg_name` : String - The name of the argument\n* `description` : String - The help text description for this option\n* `to_end` : Bool - Capture all args from this position to the end.\n* `format` : Regex - The format you expect the args to match\n* `example` : String - An example string that matches the given `format`","summary":"Creates a method of arg_name
that returns the value passed in from the CLI.
","abstract":false,"args":[{"name":"arg_name","external_name":"arg_name","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"to_end","default_value":"false","external_name":"to_end","restriction":""},{"name":"format","default_value":"nil","external_name":"format","restriction":""},{"name":"example","default_value":"nil","external_name":"example","restriction":""}],"args_string":"(arg_name, description, to_end = false, format = nil, example = nil)","args_html":"(arg_name, description, to_end = false, format = nil, example = nil)","location":{"filename":"src/lucky_task/task.cr","line_number":110,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/task.cr#L110"},"def":{"name":"positional_arg","args":[{"name":"arg_name","external_name":"arg_name","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"to_end","default_value":"false","external_name":"to_end","restriction":""},{"name":"format","default_value":"nil","external_name":"format","restriction":""},{"name":"example","default_value":"nil","external_name":"example","restriction":""}],"visibility":"Public","body":" \n{% PARSER_OPTS << arg_name %}\n\n @\n{{ arg_name.id }}\n : \n{% if to_end %}Array(String){% else %}String{% end %}\n | Nil\n\n def set_opt_for_\n{{ arg_name.id }}\n(args : Array(String))\n \n{% if to_end %}\n value = args[@positional_arg_count..-1]\n {% else %}\n value = args[@positional_arg_count]?\n {% end %}\n\n \n{% if format %}\n matches = value.is_a?(Array) ? value.all?(&.=~({{ format }})) : value =~ {{ format }}\n if !matches\n raise <<-ERROR\n Invalid format for {{ arg_name.id }}. It should match {{ format }}\n {% if example %}\n Example: {{ example.id }}\n {% end %}\n ERROR\n end\n {% end %}\n\n @\n{{ arg_name.id }}\n = value\n @positional_arg_count += 1\n \nend\n\n def \n{{ arg_name.id }}\n : \n{% if to_end %}Array(String){% else %}String{% end %}\n\n if @\n{{ arg_name.id }}\n.nil?\n raise \"\n{{ arg_name.id }}\n is required, but no value was passed.\"\n \nend\n @\n{{ arg_name.id }}\n.as(\n{% if to_end %}Array(String){% else %}String{% end %}\n)\n \nend\n \n"}},{"html_id":"summary(summary_text)-macro","name":"summary","doc":"The general description of what this task does\n\nThis is used in the help_text when a help flag is passed\nto the task through the CLI","summary":"The general description of what this task does
","abstract":false,"args":[{"name":"summary_text","external_name":"summary_text","restriction":""}],"args_string":"(summary_text)","args_html":"(summary_text)","location":{"filename":"src/lucky_task/task.cr","line_number":56,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/task.cr#L56"},"def":{"name":"summary","args":[{"name":"summary_text","external_name":"summary_text","restriction":""}],"visibility":"Public","body":" def self.task_summary : String\n \n{{ summary_text }}\n\n \nend\n \n"}},{"html_id":"switch(arg_name,description,shortcut=nil)-macro","name":"switch","doc":"Creates a method of `arg_name` where the return value is boolean.\nIf the flag `--arg_name` is passed, the value is `true`.\n\n* `arg_name` : String - The name of the argument\n* `description` : String - The help text description for this option\n* `shorcut` : String - An optional short flag (e.g. `-a`)","summary":"Creates a method of arg_name
where the return value is boolean.
","abstract":false,"args":[{"name":"arg_name","external_name":"arg_name","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"shortcut","default_value":"nil","external_name":"shortcut","restriction":""}],"args_string":"(arg_name, description, shortcut = nil)","args_html":"(arg_name, description, shortcut = nil)","location":{"filename":"src/lucky_task/task.cr","line_number":202,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/task.cr#L202"},"def":{"name":"switch","args":[{"name":"arg_name","external_name":"arg_name","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"shortcut","default_value":"nil","external_name":"shortcut","restriction":""}],"visibility":"Public","body":" \n{% PARSER_OPTS << arg_name %}\n\n @\n{{ arg_name.id }}\n : Bool = false\n\n def set_opt_for_\n{{ arg_name.id }}\n(unused_args : Array(String))\n option_parser.on(\n \n{% if shortcut %}\"{{ shortcut.id }}\",{% end %}\n\n \"--\n{{ (arg_name.id.stringify.underscore.gsub(/_/, \"-\")).id }}\n\",\n \n{{ description }}\n\n ) do\n @\n{{ arg_name.id }}\n = true\n \nend\n \nend\n\n def \n{{ arg_name.id }}\n? : Bool\n @\n{{ arg_name.id }}\n\n \nend\n \n"}}]},{"html_id":"lucky_task/LuckyTask/TaskNotFoundErrorMessage","path":"LuckyTask/TaskNotFoundErrorMessage.html","kind":"class","full_name":"LuckyTask::TaskNotFoundErrorMessage","name":"TaskNotFoundErrorMessage","abstract":false,"superclass":{"html_id":"lucky_task/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"lucky_task/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"lucky_task/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/lucky_task/task_not_found_error_message.cr","line_number":3,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/task_not_found_error_message.cr#L3"}],"repository_name":"lucky_task","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"lucky_task/LuckyTask","kind":"module","full_name":"LuckyTask","name":"LuckyTask"},"class_methods":[{"html_id":"print(*args):Nil-class-method","name":"print","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args) : Nil","args_html":"(*args) : Nil","location":{"filename":"src/lucky_task/task_not_found_error_message.cr","line_number":7,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/task_not_found_error_message.cr#L7"},"def":{"name":"print","args":[{"name":"args","external_name":"args","restriction":""}],"splat_index":0,"return_type":"Nil","visibility":"Public","body":"(new(*args)).print"}}],"constructors":[{"html_id":"new(task_name:String,io:IO=STDERR)-class-method","name":"new","abstract":false,"args":[{"name":"task_name","external_name":"task_name","restriction":"String"},{"name":"io","default_value":"STDERR","external_name":"io","restriction":"IO"}],"args_string":"(task_name : String, io : IO = STDERR)","args_html":"(task_name : String, io : IO = STDERR)","location":{"filename":"src/lucky_task/task_not_found_error_message.cr","line_number":4,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/task_not_found_error_message.cr#L4"},"def":{"name":"new","args":[{"name":"task_name","external_name":"task_name","restriction":"String"},{"name":"io","default_value":"STDERR","external_name":"io","restriction":"IO"}],"visibility":"Public","body":"_ = allocate\n_.initialize(task_name, io)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"print:Nil-instance-method","name":"print","abstract":false,"location":{"filename":"src/lucky_task/task_not_found_error_message.cr","line_number":11,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/task_not_found_error_message.cr#L11"},"def":{"name":"print","return_type":"Nil","visibility":"Public","body":"message = \"Task #{@task_name.colorize(:cyan)} not found.\"\nsimilar_task_name.try do |name|\n message = message + (\" Did you mean '#{name}'?\".colorize(:yellow)).to_s\nend\n@io.puts(message)\n"}}]},{"html_id":"lucky_task/LuckyTask/TextHelpers","path":"LuckyTask/TextHelpers.html","kind":"module","full_name":"LuckyTask::TextHelpers","name":"TextHelpers","abstract":false,"locations":[{"filename":"src/lucky_task/text_helpers.cr","line_number":1,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/text_helpers.cr#L1"}],"repository_name":"lucky_task","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"lucky_task/LuckyTask","kind":"module","full_name":"LuckyTask","name":"LuckyTask"},"instance_methods":[{"html_id":"arrow:String-instance-method","name":"arrow","abstract":false,"location":{"filename":"src/lucky_task/text_helpers.cr","line_number":2,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/text_helpers.cr#L2"},"def":{"name":"arrow","return_type":"String","visibility":"Public","body":"\"▸\""}},{"html_id":"green_arrow:Colorize::Object(String)-instance-method","name":"green_arrow","abstract":false,"location":{"filename":"src/lucky_task/text_helpers.cr","line_number":10,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/text_helpers.cr#L10"},"def":{"name":"green_arrow","return_type":"Colorize::Object(String)","visibility":"Public","body":"arrow.colorize(:green)"}},{"html_id":"red_arrow:Colorize::Object(String)-instance-method","name":"red_arrow","abstract":false,"location":{"filename":"src/lucky_task/text_helpers.cr","line_number":6,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/text_helpers.cr#L6"},"def":{"name":"red_arrow","return_type":"Colorize::Object(String)","visibility":"Public","body":"arrow.colorize(:red)"}}]}]}]}}
\ No newline at end of file
+{"repository_name":"lucky_task","body":"# Lucky Task\n\nA Crystal library for creating command line tasks to be used with the [LuckyCli](https://github.com/luckyframework/lucky_cli).\n\n## Installation\n\n1. Add the dependency to your `shard.yml`:\n\n ```yaml\n dependencies:\n lucky_task:\n github: luckyframework/lucky_task\n ```\n\n2. Run `shards install`\n\n## Integrating With LuckyCli\n\nCreate a file `tasks.cr` at the root of your project\n\n```crystal\nrequire \"lucky_task\"\n\n# Using `lucky` from the command line will do nothing if you forget this\nLuckyTask::Runner.run\n```\n\n## Creating Tasks\n\nCreate a `tasks` directory in the root of your project.\n\nUpdate your `tasks.cr` file to require all files within that directory for them to be registered with the CLI.\n\n```crystal\n# tasks.cr\nrequire \"lucky_task\"\nrequire \"./tasks/*\"\n```\n\nIn the directory create a file called `send_daily_notifications.cr`.\n\n```crystal\nclass SendDailyNotifications < LuckyTask::Task\n summary \"Send notifications to users\"\n \n # Name is inferred from class name (\"send_daily_notifications\")\n # It can be overridden:\n #\n # task_name \"app.send_daily_notifications\"\n \n def call\n # Code that sends notifications to all your users...\n end\nend\n```\n\n## Contributing\n\n1. Fork it ()\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [matthewmcgarvey](https://github.com/matthewmcgarvey) - creator and maintainer\n","program":{"html_id":"lucky_task/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"locations":[],"repository_name":"lucky_task","program":true,"enum":false,"alias":false,"const":false,"types":[{"html_id":"lucky_task/LuckyTask","path":"LuckyTask.html","kind":"module","full_name":"LuckyTask","name":"LuckyTask","abstract":false,"locations":[{"filename":"src/lucky_task.cr","line_number":5,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task.cr#L5"},{"filename":"src/lucky_task/text_helpers.cr","line_number":1,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/text_helpers.cr#L1"}],"repository_name":"lucky_task","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"VERSION","name":"VERSION","value":"\"0.3.0\""}],"types":[{"html_id":"lucky_task/LuckyTask/Runner","path":"LuckyTask/Runner.html","kind":"class","full_name":"LuckyTask::Runner","name":"Runner","abstract":false,"superclass":{"html_id":"lucky_task/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"lucky_task/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"lucky_task/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/lucky_task/runner.cr","line_number":1,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/runner.cr#L1"}],"repository_name":"lucky_task","program":false,"enum":false,"alias":false,"const":false,"extended_modules":[{"html_id":"lucky_task/LuckyTask/TextHelpers","kind":"module","full_name":"LuckyTask::TextHelpers","name":"TextHelpers"}],"namespace":{"html_id":"lucky_task/LuckyTask","kind":"module","full_name":"LuckyTask","name":"LuckyTask"},"class_methods":[{"html_id":"exit_with_error_if_not_found=(exit_with_error_if_not_found:Bool)-class-method","name":"exit_with_error_if_not_found=","abstract":false,"args":[{"name":"exit_with_error_if_not_found","external_name":"exit_with_error_if_not_found","restriction":"Bool"}],"args_string":"(exit_with_error_if_not_found : Bool)","args_html":"(exit_with_error_if_not_found : Bool)","location":{"filename":"src/lucky_task/runner.cr","line_number":3,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/runner.cr#L3"},"def":{"name":"exit_with_error_if_not_found=","args":[{"name":"exit_with_error_if_not_found","external_name":"exit_with_error_if_not_found","restriction":"Bool"}],"visibility":"Public","body":"@@exit_with_error_if_not_found = exit_with_error_if_not_found"}},{"html_id":"exit_with_error_if_not_found?:Bool-class-method","name":"exit_with_error_if_not_found?","abstract":false,"location":{"filename":"src/lucky_task/runner.cr","line_number":3,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/runner.cr#L3"},"def":{"name":"exit_with_error_if_not_found?","return_type":"Bool","visibility":"Public","body":"@@exit_with_error_if_not_found"}},{"html_id":"find_task(task_name:String):LuckyTask::Task|Nil-class-method","name":"find_task","abstract":false,"args":[{"name":"task_name","external_name":"task_name","restriction":"String"}],"args_string":"(task_name : String) : LuckyTask::Task | Nil","args_html":"(task_name : String) : LuckyTask::Task | Nil","location":{"filename":"src/lucky_task/runner.cr","line_number":49,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/runner.cr#L49"},"def":{"name":"find_task","args":[{"name":"task_name","external_name":"task_name","restriction":"String"}],"return_type":"LuckyTask::Task | ::Nil","visibility":"Public","body":"found_task = @@tasks.find do |task|\n task.task_name == task_name\nend\nif found_task\n found_task.new\nend\n"}},{"html_id":"help_text:Nil-class-method","name":"help_text","abstract":false,"location":{"filename":"src/lucky_task/runner.cr","line_number":39,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/runner.cr#L39"},"def":{"name":"help_text","return_type":"Nil","visibility":"Public","body":"puts(\"Usage: lucky name.of.task [options]\\n\\nAvailable tasks:\\n\\n#{tasks_list}\")"}},{"html_id":"list_padding_for(task_name):String-class-method","name":"list_padding_for","abstract":false,"args":[{"name":"task_name","external_name":"task_name","restriction":""}],"args_string":"(task_name) : String","args_html":"(task_name) : String","location":{"filename":"src/lucky_task/runner.cr","line_number":67,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/runner.cr#L67"},"def":{"name":"list_padding_for","args":[{"name":"task_name","external_name":"task_name","restriction":""}],"return_type":"String","visibility":"Public","body":"\" \" * ((longest_task_name - task_name.size) + 2)"}},{"html_id":"longest_task_name:Int32-class-method","name":"longest_task_name","abstract":false,"location":{"filename":"src/lucky_task/runner.cr","line_number":71,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/runner.cr#L71"},"def":{"name":"longest_task_name","return_type":"Int32","visibility":"Public","body":"tasks.max_of() do |__arg1|\n __arg1.task_name.size\nend"}},{"html_id":"register_task(task:LuckyTask::Task.class):Nil-class-method","name":"register_task","abstract":false,"args":[{"name":"task","external_name":"task","restriction":"LuckyTask::Task.class"}],"args_string":"(task : LuckyTask::Task.class) : Nil","args_html":"(task : LuckyTask::Task.class) : Nil","location":{"filename":"src/lucky_task/runner.cr","line_number":7,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/runner.cr#L7"},"def":{"name":"register_task","args":[{"name":"task","external_name":"task","restriction":"LuckyTask::Task.class"}],"return_type":"Nil","visibility":"Public","body":"@@tasks.push(task)"}},{"html_id":"run(args=ARGV,io:IO=STDERR)-class-method","name":"run","abstract":false,"args":[{"name":"args","default_value":"ARGV","external_name":"args","restriction":""},{"name":"io","default_value":"STDERR","external_name":"io","restriction":"IO"}],"args_string":"(args = ARGV, io : IO = STDERR)","args_html":"(args = ARGV, io : IO = STDERR)","location":{"filename":"src/lucky_task/runner.cr","line_number":15,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/runner.cr#L15"},"def":{"name":"run","args":[{"name":"args","default_value":"ARGV","external_name":"args","restriction":""},{"name":"io","default_value":"STDERR","external_name":"io","restriction":"IO"}],"visibility":"Public","body":"task_name = args.shift?\nif (!task_name.nil?) && ({\"--help\", \"-h\"}.includes?(task_name))\n puts(help_text)\nelse\n if task_name.nil?\n io.puts(\"Missing a task name\\n\\nTo see a list of available tasks, run #{\"lucky tasks\".colorize(:green)}\")\n else\n if task = find_task(task_name)\n task.output = io\n task.print_help_or_call(args)\n else\n TaskNotFoundErrorMessage.print(task_name)\n if exit_with_error_if_not_found?\n exit(127)\n end\n end\n end\nend\n"}},{"html_id":"tasks:Array(LuckyTask::Task.class)-class-method","name":"tasks","abstract":false,"location":{"filename":"src/lucky_task/runner.cr","line_number":11,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/runner.cr#L11"},"def":{"name":"tasks","return_type":"Array(LuckyTask::Task.class)","visibility":"Public","body":"@@tasks.sort_by!(&.task_name)"}},{"html_id":"tasks_list:String-class-method","name":"tasks_list","abstract":false,"location":{"filename":"src/lucky_task/runner.cr","line_number":56,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/runner.cr#L56"},"def":{"name":"tasks_list","return_type":"String","visibility":"Public","body":"String.build do |list|\n tasks.each do |task|\n list << ((\" #{arrow} \" + task.task_name).colorize(:green))\n list << (list_padding_for(task.task_name))\n list << task.task_summary\n list << \"\\n\"\n end\nend"}}]},{"html_id":"lucky_task/LuckyTask/Task","path":"LuckyTask/Task.html","kind":"class","full_name":"LuckyTask::Task","name":"Task","abstract":true,"superclass":{"html_id":"lucky_task/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"lucky_task/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"lucky_task/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/lucky_task/task.cr","line_number":1,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/task.cr#L1"}],"repository_name":"lucky_task","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"lucky_task/LuckyTask","kind":"module","full_name":"LuckyTask","name":"LuckyTask"},"instance_methods":[{"html_id":"call-instance-method","name":"call","abstract":true,"location":{"filename":"src/lucky_task/task.cr","line_number":295,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/task.cr#L295"},"def":{"name":"call","visibility":"Public","body":""}}],"macros":[{"html_id":"arg(arg_name,description,shortcut=nil,optional=false,format=nil,example=nil)-macro","name":"arg","doc":"Creates a method of `arg_name` that returns the value passed in from the CLI.\nThe CLI arg is specified by the `--arg_name=VALUE` flag.\n\n* `arg_name` : String - The name of the argument\n* `description` : String - The help text description for this option\n* `shorcut` : String - An optional short flag (e.g. -a VALUE)\n* `optional` : Bool - When false, raise exception if this arg is not passed\n* `format` : Regex - The format you expect the args to match\n* `example` : String - An example string that matches the given `format`","summary":"Creates a method of arg_name
that returns the value passed in from the CLI.
","abstract":false,"args":[{"name":"arg_name","external_name":"arg_name","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"shortcut","default_value":"nil","external_name":"shortcut","restriction":""},{"name":"optional","default_value":"false","external_name":"optional","restriction":""},{"name":"format","default_value":"nil","external_name":"format","restriction":""},{"name":"example","default_value":"nil","external_name":"example","restriction":""}],"args_string":"(arg_name, description, shortcut = nil, optional = false, format = nil, example = nil)","args_html":"(arg_name, description, shortcut = nil, optional = false, format = nil, example = nil)","location":{"filename":"src/lucky_task/task.cr","line_number":152,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/task.cr#L152"},"def":{"name":"arg","args":[{"name":"arg_name","external_name":"arg_name","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"shortcut","default_value":"nil","external_name":"shortcut","restriction":""},{"name":"optional","default_value":"false","external_name":"optional","restriction":""},{"name":"format","default_value":"nil","external_name":"format","restriction":""},{"name":"example","default_value":"nil","external_name":"example","restriction":""}],"visibility":"Public","body":" \n{% PARSER_OPTS << arg_name %}\n\n @\n{{ arg_name.id }}\n : String?\n\n def set_opt_for_\n{{ arg_name.id }}\n(unused_args : Array(String))\n option_parser.on(\n \n{% if shortcut %}\"{{ shortcut.id }} {{ arg_name.stringify.upcase.id }}\",{% end %}\n\n \"--\n{{ (arg_name.id.stringify.underscore.gsub(/_/, \"-\")).id }}\n=\n{{ arg_name.id.stringify.upcase.id }}\n\",\n \n{{ description }}\n\n ) do |value|\n value = value.strip\n \n{% if format %}\n if value !~ {{ format }}\n raise <<-ERROR\n Invalid format for {{ arg_name.id }}. It should match {{ format }}\n {% if example %}\n Example: {{ example.id }}\n {% end %}\n ERROR\n end\n {% end %}\n\n @\n{{ arg_name.id }}\n = value\n \nend\n \nend\n\n def \n{{ arg_name.id }}\n : String\n{% if optional %}?{% end %}\n\n \n{% if !optional %}\n if @{{ arg_name.id }}.nil?\n raise <<-ERROR\n {{ arg_name.id }} is required, but no value was passed.\n\n Try this...\n\n {% if shortcut %}{{ shortcut.id }} SOME_VALUE{% end %}\n --{{ (arg_name.id.stringify.underscore.gsub(/_/, \"-\")).id }}=SOME_VALUE\n ERROR\n end\n @{{ arg_name.id }}.as(String)\n {% else %}\n @{{ arg_name.id }}\n {% end %}\n\n \nend\n \n"}},{"html_id":"float64(arg_name,description,shortcut=nil,default=nil)-macro","name":"float64","doc":"Creates a method of `arg_name` where the return value is an Float64.\nIf the flag `--arg_name` is passed, the result is the value passed, otherwise is set to\nthe specified default, or `0.0` when not specified.\n\n* `arg_name` : String - The name of the argument\n* `description` : String - The help text description for this option\n* `shorcut` : String - An optional short flag (e.g. `-a`)\n* `default` : Float64 - An optional default value (`0.0` is default when omittted)\n\nExample:\n float64 :threshold, \"(0.1, 3.14, -5.1, etc.)\", shortcut: \"-t\", default: 2.0","summary":"Creates a method of arg_name
where the return value is an Float64.
","abstract":false,"args":[{"name":"arg_name","external_name":"arg_name","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"shortcut","default_value":"nil","external_name":"shortcut","restriction":""},{"name":"default","default_value":"nil","external_name":"default","restriction":""}],"args_string":"(arg_name, description, shortcut = nil, default = nil)","args_html":"(arg_name, description, shortcut = nil, default = nil)","location":{"filename":"src/lucky_task/task.cr","line_number":269,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/task.cr#L269"},"def":{"name":"float64","args":[{"name":"arg_name","external_name":"arg_name","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"shortcut","default_value":"nil","external_name":"shortcut","restriction":""},{"name":"default","default_value":"nil","external_name":"default","restriction":""}],"visibility":"Public","body":" \n{% PARSER_OPTS << arg_name %}\n\n @\n{{ arg_name.id }}\n : Float64 = \n{{ default || 0.0 }}\n\n\n def set_opt_for_\n{{ arg_name.id }}\n(unused_args : Array(String))\n option_parser.on(\n \n{% if shortcut %}\"{{ shortcut.id }} {{ arg_name.stringify.upcase.id }}\",{% end %}\n\n \"--\n{{ (arg_name.id.stringify.underscore.gsub(/_/, \"-\")).id }}\n=\n{{ arg_name.id.stringify.upcase.id }}\n\",\n \n{{ description }}\n\n ) do |value|\n value = value.strip.gsub(\"_\", \"\")\n if value !~ /^[+-]?([0-9]*[.])?[0-9]+$/\n raise <<-ERROR\n #{value.inspect} is an invalid value for \n{{ arg_name.id }}\n. It should be a valid Float64\n Examples: 1 or 1.0 or 1_000.0 or -1.0\n ERROR\n \nend\n @\n{{ arg_name.id }}\n = value.to_f64\n \nend\n \nend\n\n def \n{{ arg_name.id }}\n : Float64\n @\n{{ arg_name.id }}\n\n \nend\n \n"}},{"html_id":"help_message(help_text)-macro","name":"help_message","doc":"Customize your help message with the provided `help_text`\n\n```\nclass KeyGen < LuckyTask::Task\n summary \"Generate a new key\"\n help_message \"Call lucky key_gen to generate a new key\"\n\n # other methods, etc.\nend\n```","summary":"Customize your help message with the provided help_text
","abstract":false,"args":[{"name":"help_text","external_name":"help_text","restriction":""}],"args_string":"(help_text)","args_html":"(help_text)","location":{"filename":"src/lucky_task/task.cr","line_number":92,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/task.cr#L92"},"def":{"name":"help_message","args":[{"name":"help_text","external_name":"help_text","restriction":""}],"visibility":"Public","body":" def self.task_help_message : String\n \n{{ help_text }}\n\n \nend\n \n"}},{"html_id":"int32(arg_name,description,shortcut=nil,default=nil)-macro","name":"int32","doc":"Creates a method of `arg_name` where the return value is an Int32.\nIf the flag `--arg_name` is passed, the result is the value passed, otherwise is set to\nthe specified default, or `0` when not specified.\n\n* `arg_name` : String - The name of the argument\n* `description` : String - The help text description for this option\n* `shorcut` : String - An optional short flag (e.g. `-a`)\n* `default` : Int32 - An optional default value (`0` is default when omittted)\n\nExample:\n int32 :limit, \"limit (1000, 10_000, etc.)\", shortcut: \"-l\", default: 1_000","summary":"Creates a method of arg_name
where the return value is an Int32.
","abstract":false,"args":[{"name":"arg_name","external_name":"arg_name","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"shortcut","default_value":"nil","external_name":"shortcut","restriction":""},{"name":"default","default_value":"nil","external_name":"default","restriction":""}],"args_string":"(arg_name, description, shortcut = nil, default = nil)","args_html":"(arg_name, description, shortcut = nil, default = nil)","location":{"filename":"src/lucky_task/task.cr","line_number":232,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/task.cr#L232"},"def":{"name":"int32","args":[{"name":"arg_name","external_name":"arg_name","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"shortcut","default_value":"nil","external_name":"shortcut","restriction":""},{"name":"default","default_value":"nil","external_name":"default","restriction":""}],"visibility":"Public","body":" \n{% PARSER_OPTS << arg_name %}\n\n @\n{{ arg_name.id }}\n : Int32 = \n{{ default || 0 }}\n\n\n def set_opt_for_\n{{ arg_name.id }}\n(unused_args : Array(String))\n option_parser.on(\n \n{% if shortcut %}\"{{ shortcut.id }} {{ arg_name.stringify.upcase.id }}\",{% end %}\n\n \"--\n{{ (arg_name.id.stringify.underscore.gsub(/_/, \"-\")).id }}\n=\n{{ arg_name.id.stringify.upcase.id }}\n\",\n \n{{ description }}\n\n ) do |value|\n value = value.strip\n if value !~ /^[\\+\\-]?[0-9\\_]+$/\n raise <<-ERROR\n #{value.inspect} is an invalid value for \n{{ arg_name.id }}\n. It should be a valid Int32\n Examples: 1 or 1000 or 10_000 or -1\n ERROR\n \nend\n @\n{{ arg_name.id }}\n = value.gsub(/[\\_]/, \"\").to_i32\n \nend\n \nend\n\n def \n{{ arg_name.id }}\n : Int32\n @\n{{ arg_name.id }}\n\n \nend\n \n"}},{"html_id":"name(name_text)-macro","name":"name","doc":"Renames the task name for CLI use\n\nBy default the task name is derived from the full module and class name.\nHowever if that task name is not desired, a custom one can be set.\n\n```\nclass Dev::Prime < LuckyTask::Task\n # Would be \"dev.prime\" by default, but we want to set it to \"dev.setup\":\n task_name \"dev.setup\"\n summary \"Seed the development database with example data\"\n\n # other methods, etc.\nend\n```","summary":"Renames the task name for CLI use
","abstract":false,"args":[{"name":"name_text","external_name":"name_text","restriction":""}],"args_string":"(name_text)","args_html":"(name_text)","location":{"filename":"src/lucky_task/task.cr","line_number":76,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/task.cr#L76"},"def":{"name":"name","args":[{"name":"name_text","external_name":"name_text","restriction":""}],"visibility":"Public","body":" def self.task_name : String\n \n{{ name_text }}\n\n \nend\n \n"}},{"html_id":"positional_arg(arg_name,description,to_end=false,format=nil,example=nil)-macro","name":"positional_arg","doc":"Creates a method of `arg_name` that returns the value passed in from the CLI.\nThe CLI arg position is based on the order in which `positional_arg` is specified\nwith the first call being position 0, and so on.\n\nIf your arg takes more than one value, you can set `to_end` to true to capture all\nargs from this position to the end. This will make your `arg_name` method return `Array(String)`.\n\n* `arg_name` : String - The name of the argument\n* `description` : String - The help text description for this option\n* `to_end` : Bool - Capture all args from this position to the end.\n* `format` : Regex - The format you expect the args to match\n* `example` : String - An example string that matches the given `format`","summary":"Creates a method of arg_name
that returns the value passed in from the CLI.
","abstract":false,"args":[{"name":"arg_name","external_name":"arg_name","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"to_end","default_value":"false","external_name":"to_end","restriction":""},{"name":"format","default_value":"nil","external_name":"format","restriction":""},{"name":"example","default_value":"nil","external_name":"example","restriction":""}],"args_string":"(arg_name, description, to_end = false, format = nil, example = nil)","args_html":"(arg_name, description, to_end = false, format = nil, example = nil)","location":{"filename":"src/lucky_task/task.cr","line_number":110,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/task.cr#L110"},"def":{"name":"positional_arg","args":[{"name":"arg_name","external_name":"arg_name","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"to_end","default_value":"false","external_name":"to_end","restriction":""},{"name":"format","default_value":"nil","external_name":"format","restriction":""},{"name":"example","default_value":"nil","external_name":"example","restriction":""}],"visibility":"Public","body":" \n{% PARSER_OPTS << arg_name %}\n\n @\n{{ arg_name.id }}\n : \n{% if to_end %}Array(String){% else %}String{% end %}\n | Nil\n\n def set_opt_for_\n{{ arg_name.id }}\n(args : Array(String))\n \n{% if to_end %}\n value = args[@positional_arg_count..-1]\n {% else %}\n value = args[@positional_arg_count]?\n {% end %}\n\n \n{% if format %}\n matches = value.is_a?(Array) ? value.all?(&.=~({{ format }})) : value =~ {{ format }}\n if !matches\n raise <<-ERROR\n Invalid format for {{ arg_name.id }}. It should match {{ format }}\n {% if example %}\n Example: {{ example.id }}\n {% end %}\n ERROR\n end\n {% end %}\n\n @\n{{ arg_name.id }}\n = value\n @positional_arg_count += 1\n \nend\n\n def \n{{ arg_name.id }}\n : \n{% if to_end %}Array(String){% else %}String{% end %}\n\n if @\n{{ arg_name.id }}\n.nil?\n raise \"\n{{ arg_name.id }}\n is required, but no value was passed.\"\n \nend\n @\n{{ arg_name.id }}\n.as(\n{% if to_end %}Array(String){% else %}String{% end %}\n)\n \nend\n \n"}},{"html_id":"summary(summary_text)-macro","name":"summary","doc":"The general description of what this task does\n\nThis is used in the help_text when a help flag is passed\nto the task through the CLI","summary":"The general description of what this task does
","abstract":false,"args":[{"name":"summary_text","external_name":"summary_text","restriction":""}],"args_string":"(summary_text)","args_html":"(summary_text)","location":{"filename":"src/lucky_task/task.cr","line_number":56,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/task.cr#L56"},"def":{"name":"summary","args":[{"name":"summary_text","external_name":"summary_text","restriction":""}],"visibility":"Public","body":" def self.task_summary : String\n \n{{ summary_text }}\n\n \nend\n \n"}},{"html_id":"switch(arg_name,description,shortcut=nil)-macro","name":"switch","doc":"Creates a method of `arg_name` where the return value is boolean.\nIf the flag `--arg_name` is passed, the value is `true`.\n\n* `arg_name` : String - The name of the argument\n* `description` : String - The help text description for this option\n* `shorcut` : String - An optional short flag (e.g. `-a`)","summary":"Creates a method of arg_name
where the return value is boolean.
","abstract":false,"args":[{"name":"arg_name","external_name":"arg_name","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"shortcut","default_value":"nil","external_name":"shortcut","restriction":""}],"args_string":"(arg_name, description, shortcut = nil)","args_html":"(arg_name, description, shortcut = nil)","location":{"filename":"src/lucky_task/task.cr","line_number":202,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/task.cr#L202"},"def":{"name":"switch","args":[{"name":"arg_name","external_name":"arg_name","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"shortcut","default_value":"nil","external_name":"shortcut","restriction":""}],"visibility":"Public","body":" \n{% PARSER_OPTS << arg_name %}\n\n @\n{{ arg_name.id }}\n : Bool = false\n\n def set_opt_for_\n{{ arg_name.id }}\n(unused_args : Array(String))\n option_parser.on(\n \n{% if shortcut %}\"{{ shortcut.id }}\",{% end %}\n\n \"--\n{{ (arg_name.id.stringify.underscore.gsub(/_/, \"-\")).id }}\n\",\n \n{{ description }}\n\n ) do\n @\n{{ arg_name.id }}\n = true\n \nend\n \nend\n\n def \n{{ arg_name.id }}\n? : Bool\n @\n{{ arg_name.id }}\n\n \nend\n \n"}}]},{"html_id":"lucky_task/LuckyTask/TaskNotFoundErrorMessage","path":"LuckyTask/TaskNotFoundErrorMessage.html","kind":"class","full_name":"LuckyTask::TaskNotFoundErrorMessage","name":"TaskNotFoundErrorMessage","abstract":false,"superclass":{"html_id":"lucky_task/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"lucky_task/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"lucky_task/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/lucky_task/task_not_found_error_message.cr","line_number":3,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/task_not_found_error_message.cr#L3"}],"repository_name":"lucky_task","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"lucky_task/LuckyTask","kind":"module","full_name":"LuckyTask","name":"LuckyTask"},"class_methods":[{"html_id":"print(*args):Nil-class-method","name":"print","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args) : Nil","args_html":"(*args) : Nil","location":{"filename":"src/lucky_task/task_not_found_error_message.cr","line_number":7,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/task_not_found_error_message.cr#L7"},"def":{"name":"print","args":[{"name":"args","external_name":"args","restriction":""}],"splat_index":0,"return_type":"Nil","visibility":"Public","body":"(new(*args)).print"}}],"constructors":[{"html_id":"new(task_name:String,io:IO=STDERR)-class-method","name":"new","abstract":false,"args":[{"name":"task_name","external_name":"task_name","restriction":"String"},{"name":"io","default_value":"STDERR","external_name":"io","restriction":"IO"}],"args_string":"(task_name : String, io : IO = STDERR)","args_html":"(task_name : String, io : IO = STDERR)","location":{"filename":"src/lucky_task/task_not_found_error_message.cr","line_number":4,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/task_not_found_error_message.cr#L4"},"def":{"name":"new","args":[{"name":"task_name","external_name":"task_name","restriction":"String"},{"name":"io","default_value":"STDERR","external_name":"io","restriction":"IO"}],"visibility":"Public","body":"_ = allocate\n_.initialize(task_name, io)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"print:Nil-instance-method","name":"print","abstract":false,"location":{"filename":"src/lucky_task/task_not_found_error_message.cr","line_number":11,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/task_not_found_error_message.cr#L11"},"def":{"name":"print","return_type":"Nil","visibility":"Public","body":"message = \"Task #{@task_name.colorize(:cyan)} not found.\"\nsimilar_task_name.try do |name|\n message = message + (\" Did you mean '#{name}'?\".colorize(:yellow)).to_s\nend\n@io.puts(message)\n"}}]},{"html_id":"lucky_task/LuckyTask/TextHelpers","path":"LuckyTask/TextHelpers.html","kind":"module","full_name":"LuckyTask::TextHelpers","name":"TextHelpers","abstract":false,"locations":[{"filename":"src/lucky_task/text_helpers.cr","line_number":1,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/text_helpers.cr#L1"}],"repository_name":"lucky_task","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"lucky_task/LuckyTask","kind":"module","full_name":"LuckyTask","name":"LuckyTask"},"instance_methods":[{"html_id":"arrow:String-instance-method","name":"arrow","abstract":false,"location":{"filename":"src/lucky_task/text_helpers.cr","line_number":2,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/text_helpers.cr#L2"},"def":{"name":"arrow","return_type":"String","visibility":"Public","body":"\"▸\""}},{"html_id":"green_arrow:Colorize::Object(String)-instance-method","name":"green_arrow","abstract":false,"location":{"filename":"src/lucky_task/text_helpers.cr","line_number":10,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/text_helpers.cr#L10"},"def":{"name":"green_arrow","return_type":"Colorize::Object(String)","visibility":"Public","body":"arrow.colorize(:green)"}},{"html_id":"red_arrow:Colorize::Object(String)-instance-method","name":"red_arrow","abstract":false,"location":{"filename":"src/lucky_task/text_helpers.cr","line_number":6,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/text_helpers.cr#L6"},"def":{"name":"red_arrow","return_type":"Colorize::Object(String)","visibility":"Public","body":"arrow.colorize(:red)"}}]}]}]}}
\ No newline at end of file
diff --git a/search-index.js b/search-index.js
index c604c0a..bf02241 100644
--- a/search-index.js
+++ b/search-index.js
@@ -1 +1 @@
-crystal_doc_search_index_callback({"repository_name":"lucky_task","body":"# Lucky Task\n\nA Crystal library for creating command line tasks to be used with the [LuckyCli](https://github.com/luckyframework/lucky_cli).\n\n## Installation\n\n1. Add the dependency to your `shard.yml`:\n\n ```yaml\n dependencies:\n lucky_task:\n github: luckyframework/lucky_task\n ```\n\n2. Run `shards install`\n\n## Integrating With LuckyCli\n\nCreate a file `tasks.cr` at the root of your project\n\n```crystal\nrequire \"lucky_task\"\n\n# Using `lucky` from the command line will do nothing if you forget this\nLuckyTask::Runner.run\n```\n\n## Creating Tasks\n\nCreate a `tasks` directory in the root of your project.\n\nUpdate your `tasks.cr` file to require all files within that directory for them to be registered with the CLI.\n\n```crystal\n# tasks.cr\nrequire \"lucky_task\"\nrequire \"./tasks/*\"\n```\n\nIn the directory create a file called `send_daily_notifications.cr`.\n\n```crystal\nclass SendDailyNotifications < LuckyTask::Task\n summary \"Send notifications to users\"\n \n # Name is inferred from class name (\"send_daily_notifications\")\n # It can be overridden:\n #\n # task_name \"app.send_daily_notifications\"\n \n def call\n # Code that sends notifications to all your users...\n end\nend\n```\n\n## Contributing\n\n1. Fork it ()\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [matthewmcgarvey](https://github.com/matthewmcgarvey) - creator and maintainer\n","program":{"html_id":"lucky_task/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"locations":[],"repository_name":"lucky_task","program":true,"enum":false,"alias":false,"const":false,"types":[{"html_id":"lucky_task/LuckyTask","path":"LuckyTask.html","kind":"module","full_name":"LuckyTask","name":"LuckyTask","abstract":false,"locations":[{"filename":"src/lucky_task.cr","line_number":5,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task.cr#L5"},{"filename":"src/lucky_task/text_helpers.cr","line_number":1,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/text_helpers.cr#L1"}],"repository_name":"lucky_task","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"VERSION","name":"VERSION","value":"\"0.2.0\""}],"types":[{"html_id":"lucky_task/LuckyTask/Runner","path":"LuckyTask/Runner.html","kind":"class","full_name":"LuckyTask::Runner","name":"Runner","abstract":false,"superclass":{"html_id":"lucky_task/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"lucky_task/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"lucky_task/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/lucky_task/runner.cr","line_number":1,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/runner.cr#L1"}],"repository_name":"lucky_task","program":false,"enum":false,"alias":false,"const":false,"extended_modules":[{"html_id":"lucky_task/LuckyTask/TextHelpers","kind":"module","full_name":"LuckyTask::TextHelpers","name":"TextHelpers"}],"namespace":{"html_id":"lucky_task/LuckyTask","kind":"module","full_name":"LuckyTask","name":"LuckyTask"},"class_methods":[{"html_id":"exit_with_error_if_not_found=(exit_with_error_if_not_found:Bool)-class-method","name":"exit_with_error_if_not_found=","abstract":false,"args":[{"name":"exit_with_error_if_not_found","external_name":"exit_with_error_if_not_found","restriction":"Bool"}],"args_string":"(exit_with_error_if_not_found : Bool)","args_html":"(exit_with_error_if_not_found : Bool)","location":{"filename":"src/lucky_task/runner.cr","line_number":3,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/runner.cr#L3"},"def":{"name":"exit_with_error_if_not_found=","args":[{"name":"exit_with_error_if_not_found","external_name":"exit_with_error_if_not_found","restriction":"Bool"}],"visibility":"Public","body":"@@exit_with_error_if_not_found = exit_with_error_if_not_found"}},{"html_id":"exit_with_error_if_not_found?:Bool-class-method","name":"exit_with_error_if_not_found?","abstract":false,"location":{"filename":"src/lucky_task/runner.cr","line_number":3,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/runner.cr#L3"},"def":{"name":"exit_with_error_if_not_found?","return_type":"Bool","visibility":"Public","body":"@@exit_with_error_if_not_found"}},{"html_id":"find_task(task_name:String):LuckyTask::Task|Nil-class-method","name":"find_task","abstract":false,"args":[{"name":"task_name","external_name":"task_name","restriction":"String"}],"args_string":"(task_name : String) : LuckyTask::Task | Nil","args_html":"(task_name : String) : LuckyTask::Task | Nil","location":{"filename":"src/lucky_task/runner.cr","line_number":49,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/runner.cr#L49"},"def":{"name":"find_task","args":[{"name":"task_name","external_name":"task_name","restriction":"String"}],"return_type":"LuckyTask::Task | ::Nil","visibility":"Public","body":"found_task = @@tasks.find do |task|\n task.task_name == task_name\nend\nif found_task\n found_task.new\nend\n"}},{"html_id":"help_text:Nil-class-method","name":"help_text","abstract":false,"location":{"filename":"src/lucky_task/runner.cr","line_number":39,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/runner.cr#L39"},"def":{"name":"help_text","return_type":"Nil","visibility":"Public","body":"puts(\"Usage: lucky name.of.task [options]\\n\\nAvailable tasks:\\n\\n#{tasks_list}\")"}},{"html_id":"list_padding_for(task_name):String-class-method","name":"list_padding_for","abstract":false,"args":[{"name":"task_name","external_name":"task_name","restriction":""}],"args_string":"(task_name) : String","args_html":"(task_name) : String","location":{"filename":"src/lucky_task/runner.cr","line_number":67,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/runner.cr#L67"},"def":{"name":"list_padding_for","args":[{"name":"task_name","external_name":"task_name","restriction":""}],"return_type":"String","visibility":"Public","body":"\" \" * ((longest_task_name - task_name.size) + 2)"}},{"html_id":"longest_task_name:Int32-class-method","name":"longest_task_name","abstract":false,"location":{"filename":"src/lucky_task/runner.cr","line_number":71,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/runner.cr#L71"},"def":{"name":"longest_task_name","return_type":"Int32","visibility":"Public","body":"tasks.max_of() do |__arg1|\n __arg1.task_name.size\nend"}},{"html_id":"register_task(task:LuckyTask::Task.class):Nil-class-method","name":"register_task","abstract":false,"args":[{"name":"task","external_name":"task","restriction":"LuckyTask::Task.class"}],"args_string":"(task : LuckyTask::Task.class) : Nil","args_html":"(task : LuckyTask::Task.class) : Nil","location":{"filename":"src/lucky_task/runner.cr","line_number":7,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/runner.cr#L7"},"def":{"name":"register_task","args":[{"name":"task","external_name":"task","restriction":"LuckyTask::Task.class"}],"return_type":"Nil","visibility":"Public","body":"@@tasks.push(task)"}},{"html_id":"run(args=ARGV,io:IO=STDERR)-class-method","name":"run","abstract":false,"args":[{"name":"args","default_value":"ARGV","external_name":"args","restriction":""},{"name":"io","default_value":"STDERR","external_name":"io","restriction":"IO"}],"args_string":"(args = ARGV, io : IO = STDERR)","args_html":"(args = ARGV, io : IO = STDERR)","location":{"filename":"src/lucky_task/runner.cr","line_number":15,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/runner.cr#L15"},"def":{"name":"run","args":[{"name":"args","default_value":"ARGV","external_name":"args","restriction":""},{"name":"io","default_value":"STDERR","external_name":"io","restriction":"IO"}],"visibility":"Public","body":"task_name = args.shift?\nif (!task_name.nil?) && ({\"--help\", \"-h\"}.includes?(task_name))\n puts(help_text)\nelse\n if task_name.nil?\n io.puts(\"Missing a task name\\n\\nTo see a list of available tasks, run #{\"lucky tasks\".colorize(:green)}\")\n else\n if task = find_task(task_name)\n task.output = io\n task.print_help_or_call(args)\n else\n TaskNotFoundErrorMessage.print(task_name)\n if exit_with_error_if_not_found?\n exit(127)\n end\n end\n end\nend\n"}},{"html_id":"tasks:Array(LuckyTask::Task.class)-class-method","name":"tasks","abstract":false,"location":{"filename":"src/lucky_task/runner.cr","line_number":11,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/runner.cr#L11"},"def":{"name":"tasks","return_type":"Array(LuckyTask::Task.class)","visibility":"Public","body":"@@tasks.sort_by!(&.task_name)"}},{"html_id":"tasks_list:String-class-method","name":"tasks_list","abstract":false,"location":{"filename":"src/lucky_task/runner.cr","line_number":56,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/runner.cr#L56"},"def":{"name":"tasks_list","return_type":"String","visibility":"Public","body":"String.build do |list|\n tasks.each do |task|\n list << ((\" #{arrow} \" + task.task_name).colorize(:green))\n list << (list_padding_for(task.task_name))\n list << task.task_summary\n list << \"\\n\"\n end\nend"}}]},{"html_id":"lucky_task/LuckyTask/Task","path":"LuckyTask/Task.html","kind":"class","full_name":"LuckyTask::Task","name":"Task","abstract":true,"superclass":{"html_id":"lucky_task/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"lucky_task/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"lucky_task/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/lucky_task/task.cr","line_number":1,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/task.cr#L1"}],"repository_name":"lucky_task","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"lucky_task/LuckyTask","kind":"module","full_name":"LuckyTask","name":"LuckyTask"},"instance_methods":[{"html_id":"call-instance-method","name":"call","abstract":true,"location":{"filename":"src/lucky_task/task.cr","line_number":295,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/task.cr#L295"},"def":{"name":"call","visibility":"Public","body":""}}],"macros":[{"html_id":"arg(arg_name,description,shortcut=nil,optional=false,format=nil,example=nil)-macro","name":"arg","doc":"Creates a method of `arg_name` that returns the value passed in from the CLI.\nThe CLI arg is specified by the `--arg_name=VALUE` flag.\n\n* `arg_name` : String - The name of the argument\n* `description` : String - The help text description for this option\n* `shorcut` : String - An optional short flag (e.g. -a VALUE)\n* `optional` : Bool - When false, raise exception if this arg is not passed\n* `format` : Regex - The format you expect the args to match\n* `example` : String - An example string that matches the given `format`","summary":"Creates a method of arg_name
that returns the value passed in from the CLI.
","abstract":false,"args":[{"name":"arg_name","external_name":"arg_name","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"shortcut","default_value":"nil","external_name":"shortcut","restriction":""},{"name":"optional","default_value":"false","external_name":"optional","restriction":""},{"name":"format","default_value":"nil","external_name":"format","restriction":""},{"name":"example","default_value":"nil","external_name":"example","restriction":""}],"args_string":"(arg_name, description, shortcut = nil, optional = false, format = nil, example = nil)","args_html":"(arg_name, description, shortcut = nil, optional = false, format = nil, example = nil)","location":{"filename":"src/lucky_task/task.cr","line_number":152,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/task.cr#L152"},"def":{"name":"arg","args":[{"name":"arg_name","external_name":"arg_name","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"shortcut","default_value":"nil","external_name":"shortcut","restriction":""},{"name":"optional","default_value":"false","external_name":"optional","restriction":""},{"name":"format","default_value":"nil","external_name":"format","restriction":""},{"name":"example","default_value":"nil","external_name":"example","restriction":""}],"visibility":"Public","body":" \n{% PARSER_OPTS << arg_name %}\n\n @\n{{ arg_name.id }}\n : String?\n\n def set_opt_for_\n{{ arg_name.id }}\n(unused_args : Array(String))\n option_parser.on(\n \n{% if shortcut %}\"{{ shortcut.id }} {{ arg_name.stringify.upcase.id }}\",{% end %}\n\n \"--\n{{ (arg_name.id.stringify.underscore.gsub(/_/, \"-\")).id }}\n=\n{{ arg_name.id.stringify.upcase.id }}\n\",\n \n{{ description }}\n\n ) do |value|\n value = value.strip\n \n{% if format %}\n if value !~ {{ format }}\n raise <<-ERROR\n Invalid format for {{ arg_name.id }}. It should match {{ format }}\n {% if example %}\n Example: {{ example.id }}\n {% end %}\n ERROR\n end\n {% end %}\n\n @\n{{ arg_name.id }}\n = value\n \nend\n \nend\n\n def \n{{ arg_name.id }}\n : String\n{% if optional %}?{% end %}\n\n \n{% if !optional %}\n if @{{ arg_name.id }}.nil?\n raise <<-ERROR\n {{ arg_name.id }} is required, but no value was passed.\n\n Try this...\n\n {% if shortcut %}{{ shortcut.id }} SOME_VALUE{% end %}\n --{{ (arg_name.id.stringify.underscore.gsub(/_/, \"-\")).id }}=SOME_VALUE\n ERROR\n end\n @{{ arg_name.id }}.as(String)\n {% else %}\n @{{ arg_name.id }}\n {% end %}\n\n \nend\n \n"}},{"html_id":"float64(arg_name,description,shortcut=nil,default=nil)-macro","name":"float64","doc":"Creates a method of `arg_name` where the return value is an Float64.\nIf the flag `--arg_name` is passed, the result is the value passed, otherwise is set to\nthe specified default, or `0.0` when not specified.\n\n* `arg_name` : String - The name of the argument\n* `description` : String - The help text description for this option\n* `shorcut` : String - An optional short flag (e.g. `-a`)\n* `default` : Float64 - An optional default value (`0.0` is default when omittted)\n\nExample:\n float64 :threshold, \"(0.1, 3.14, -5.1, etc.)\", shortcut: \"-t\", default: 2.0","summary":"Creates a method of arg_name
where the return value is an Float64.
","abstract":false,"args":[{"name":"arg_name","external_name":"arg_name","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"shortcut","default_value":"nil","external_name":"shortcut","restriction":""},{"name":"default","default_value":"nil","external_name":"default","restriction":""}],"args_string":"(arg_name, description, shortcut = nil, default = nil)","args_html":"(arg_name, description, shortcut = nil, default = nil)","location":{"filename":"src/lucky_task/task.cr","line_number":269,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/task.cr#L269"},"def":{"name":"float64","args":[{"name":"arg_name","external_name":"arg_name","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"shortcut","default_value":"nil","external_name":"shortcut","restriction":""},{"name":"default","default_value":"nil","external_name":"default","restriction":""}],"visibility":"Public","body":" \n{% PARSER_OPTS << arg_name %}\n\n @\n{{ arg_name.id }}\n : Float64 = \n{{ default || 0.0 }}\n\n\n def set_opt_for_\n{{ arg_name.id }}\n(unused_args : Array(String))\n option_parser.on(\n \n{% if shortcut %}\"{{ shortcut.id }} {{ arg_name.stringify.upcase.id }}\",{% end %}\n\n \"--\n{{ (arg_name.id.stringify.underscore.gsub(/_/, \"-\")).id }}\n=\n{{ arg_name.id.stringify.upcase.id }}\n\",\n \n{{ description }}\n\n ) do |value|\n value = value.strip.gsub(\"_\", \"\")\n if value !~ /^[+-]?([0-9]*[.])?[0-9]+$/\n raise <<-ERROR\n #{value.inspect} is an invalid value for \n{{ arg_name.id }}\n. It should be a valid Float64\n Examples: 1 or 1.0 or 1_000.0 or -1.0\n ERROR\n \nend\n @\n{{ arg_name.id }}\n = value.to_f64\n \nend\n \nend\n\n def \n{{ arg_name.id }}\n : Float64\n @\n{{ arg_name.id }}\n\n \nend\n \n"}},{"html_id":"help_message(help_text)-macro","name":"help_message","doc":"Customize your help message with the provided `help_text`\n\n```\nclass KeyGen < LuckyTask::Task\n summary \"Generate a new key\"\n help_message \"Call lucky key_gen to generate a new key\"\n\n # other methods, etc.\nend\n```","summary":"Customize your help message with the provided help_text
","abstract":false,"args":[{"name":"help_text","external_name":"help_text","restriction":""}],"args_string":"(help_text)","args_html":"(help_text)","location":{"filename":"src/lucky_task/task.cr","line_number":92,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/task.cr#L92"},"def":{"name":"help_message","args":[{"name":"help_text","external_name":"help_text","restriction":""}],"visibility":"Public","body":" def self.task_help_message : String\n \n{{ help_text }}\n\n \nend\n \n"}},{"html_id":"int32(arg_name,description,shortcut=nil,default=nil)-macro","name":"int32","doc":"Creates a method of `arg_name` where the return value is an Int32.\nIf the flag `--arg_name` is passed, the result is the value passed, otherwise is set to\nthe specified default, or `0` when not specified.\n\n* `arg_name` : String - The name of the argument\n* `description` : String - The help text description for this option\n* `shorcut` : String - An optional short flag (e.g. `-a`)\n* `default` : Int32 - An optional default value (`0` is default when omittted)\n\nExample:\n int32 :limit, \"limit (1000, 10_000, etc.)\", shortcut: \"-l\", default: 1_000","summary":"Creates a method of arg_name
where the return value is an Int32.
","abstract":false,"args":[{"name":"arg_name","external_name":"arg_name","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"shortcut","default_value":"nil","external_name":"shortcut","restriction":""},{"name":"default","default_value":"nil","external_name":"default","restriction":""}],"args_string":"(arg_name, description, shortcut = nil, default = nil)","args_html":"(arg_name, description, shortcut = nil, default = nil)","location":{"filename":"src/lucky_task/task.cr","line_number":232,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/task.cr#L232"},"def":{"name":"int32","args":[{"name":"arg_name","external_name":"arg_name","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"shortcut","default_value":"nil","external_name":"shortcut","restriction":""},{"name":"default","default_value":"nil","external_name":"default","restriction":""}],"visibility":"Public","body":" \n{% PARSER_OPTS << arg_name %}\n\n @\n{{ arg_name.id }}\n : Int32 = \n{{ default || 0 }}\n\n\n def set_opt_for_\n{{ arg_name.id }}\n(unused_args : Array(String))\n option_parser.on(\n \n{% if shortcut %}\"{{ shortcut.id }} {{ arg_name.stringify.upcase.id }}\",{% end %}\n\n \"--\n{{ (arg_name.id.stringify.underscore.gsub(/_/, \"-\")).id }}\n=\n{{ arg_name.id.stringify.upcase.id }}\n\",\n \n{{ description }}\n\n ) do |value|\n value = value.strip\n if value !~ /^[\\+\\-]?[0-9\\_]+$/\n raise <<-ERROR\n #{value.inspect} is an invalid value for \n{{ arg_name.id }}\n. It should be a valid Int32\n Examples: 1 or 1000 or 10_000 or -1\n ERROR\n \nend\n @\n{{ arg_name.id }}\n = value.gsub(/[\\_]/, \"\").to_i32\n \nend\n \nend\n\n def \n{{ arg_name.id }}\n : Int32\n @\n{{ arg_name.id }}\n\n \nend\n \n"}},{"html_id":"name(name_text)-macro","name":"name","doc":"Renames the task name for CLI use\n\nBy default the task name is derived from the full module and class name.\nHowever if that task name is not desired, a custom one can be set.\n\n```\nclass Dev::Prime < LuckyTask::Task\n # Would be \"dev.prime\" by default, but we want to set it to \"dev.setup\":\n task_name \"dev.setup\"\n summary \"Seed the development database with example data\"\n\n # other methods, etc.\nend\n```","summary":"Renames the task name for CLI use
","abstract":false,"args":[{"name":"name_text","external_name":"name_text","restriction":""}],"args_string":"(name_text)","args_html":"(name_text)","location":{"filename":"src/lucky_task/task.cr","line_number":76,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/task.cr#L76"},"def":{"name":"name","args":[{"name":"name_text","external_name":"name_text","restriction":""}],"visibility":"Public","body":" def self.task_name : String\n \n{{ name_text }}\n\n \nend\n \n"}},{"html_id":"positional_arg(arg_name,description,to_end=false,format=nil,example=nil)-macro","name":"positional_arg","doc":"Creates a method of `arg_name` that returns the value passed in from the CLI.\nThe CLI arg position is based on the order in which `positional_arg` is specified\nwith the first call being position 0, and so on.\n\nIf your arg takes more than one value, you can set `to_end` to true to capture all\nargs from this position to the end. This will make your `arg_name` method return `Array(String)`.\n\n* `arg_name` : String - The name of the argument\n* `description` : String - The help text description for this option\n* `to_end` : Bool - Capture all args from this position to the end.\n* `format` : Regex - The format you expect the args to match\n* `example` : String - An example string that matches the given `format`","summary":"Creates a method of arg_name
that returns the value passed in from the CLI.
","abstract":false,"args":[{"name":"arg_name","external_name":"arg_name","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"to_end","default_value":"false","external_name":"to_end","restriction":""},{"name":"format","default_value":"nil","external_name":"format","restriction":""},{"name":"example","default_value":"nil","external_name":"example","restriction":""}],"args_string":"(arg_name, description, to_end = false, format = nil, example = nil)","args_html":"(arg_name, description, to_end = false, format = nil, example = nil)","location":{"filename":"src/lucky_task/task.cr","line_number":110,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/task.cr#L110"},"def":{"name":"positional_arg","args":[{"name":"arg_name","external_name":"arg_name","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"to_end","default_value":"false","external_name":"to_end","restriction":""},{"name":"format","default_value":"nil","external_name":"format","restriction":""},{"name":"example","default_value":"nil","external_name":"example","restriction":""}],"visibility":"Public","body":" \n{% PARSER_OPTS << arg_name %}\n\n @\n{{ arg_name.id }}\n : \n{% if to_end %}Array(String){% else %}String{% end %}\n | Nil\n\n def set_opt_for_\n{{ arg_name.id }}\n(args : Array(String))\n \n{% if to_end %}\n value = args[@positional_arg_count..-1]\n {% else %}\n value = args[@positional_arg_count]?\n {% end %}\n\n \n{% if format %}\n matches = value.is_a?(Array) ? value.all?(&.=~({{ format }})) : value =~ {{ format }}\n if !matches\n raise <<-ERROR\n Invalid format for {{ arg_name.id }}. It should match {{ format }}\n {% if example %}\n Example: {{ example.id }}\n {% end %}\n ERROR\n end\n {% end %}\n\n @\n{{ arg_name.id }}\n = value\n @positional_arg_count += 1\n \nend\n\n def \n{{ arg_name.id }}\n : \n{% if to_end %}Array(String){% else %}String{% end %}\n\n if @\n{{ arg_name.id }}\n.nil?\n raise \"\n{{ arg_name.id }}\n is required, but no value was passed.\"\n \nend\n @\n{{ arg_name.id }}\n.as(\n{% if to_end %}Array(String){% else %}String{% end %}\n)\n \nend\n \n"}},{"html_id":"summary(summary_text)-macro","name":"summary","doc":"The general description of what this task does\n\nThis is used in the help_text when a help flag is passed\nto the task through the CLI","summary":"The general description of what this task does
","abstract":false,"args":[{"name":"summary_text","external_name":"summary_text","restriction":""}],"args_string":"(summary_text)","args_html":"(summary_text)","location":{"filename":"src/lucky_task/task.cr","line_number":56,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/task.cr#L56"},"def":{"name":"summary","args":[{"name":"summary_text","external_name":"summary_text","restriction":""}],"visibility":"Public","body":" def self.task_summary : String\n \n{{ summary_text }}\n\n \nend\n \n"}},{"html_id":"switch(arg_name,description,shortcut=nil)-macro","name":"switch","doc":"Creates a method of `arg_name` where the return value is boolean.\nIf the flag `--arg_name` is passed, the value is `true`.\n\n* `arg_name` : String - The name of the argument\n* `description` : String - The help text description for this option\n* `shorcut` : String - An optional short flag (e.g. `-a`)","summary":"Creates a method of arg_name
where the return value is boolean.
","abstract":false,"args":[{"name":"arg_name","external_name":"arg_name","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"shortcut","default_value":"nil","external_name":"shortcut","restriction":""}],"args_string":"(arg_name, description, shortcut = nil)","args_html":"(arg_name, description, shortcut = nil)","location":{"filename":"src/lucky_task/task.cr","line_number":202,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/task.cr#L202"},"def":{"name":"switch","args":[{"name":"arg_name","external_name":"arg_name","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"shortcut","default_value":"nil","external_name":"shortcut","restriction":""}],"visibility":"Public","body":" \n{% PARSER_OPTS << arg_name %}\n\n @\n{{ arg_name.id }}\n : Bool = false\n\n def set_opt_for_\n{{ arg_name.id }}\n(unused_args : Array(String))\n option_parser.on(\n \n{% if shortcut %}\"{{ shortcut.id }}\",{% end %}\n\n \"--\n{{ (arg_name.id.stringify.underscore.gsub(/_/, \"-\")).id }}\n\",\n \n{{ description }}\n\n ) do\n @\n{{ arg_name.id }}\n = true\n \nend\n \nend\n\n def \n{{ arg_name.id }}\n? : Bool\n @\n{{ arg_name.id }}\n\n \nend\n \n"}}]},{"html_id":"lucky_task/LuckyTask/TaskNotFoundErrorMessage","path":"LuckyTask/TaskNotFoundErrorMessage.html","kind":"class","full_name":"LuckyTask::TaskNotFoundErrorMessage","name":"TaskNotFoundErrorMessage","abstract":false,"superclass":{"html_id":"lucky_task/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"lucky_task/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"lucky_task/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/lucky_task/task_not_found_error_message.cr","line_number":3,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/task_not_found_error_message.cr#L3"}],"repository_name":"lucky_task","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"lucky_task/LuckyTask","kind":"module","full_name":"LuckyTask","name":"LuckyTask"},"class_methods":[{"html_id":"print(*args):Nil-class-method","name":"print","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args) : Nil","args_html":"(*args) : Nil","location":{"filename":"src/lucky_task/task_not_found_error_message.cr","line_number":7,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/task_not_found_error_message.cr#L7"},"def":{"name":"print","args":[{"name":"args","external_name":"args","restriction":""}],"splat_index":0,"return_type":"Nil","visibility":"Public","body":"(new(*args)).print"}}],"constructors":[{"html_id":"new(task_name:String,io:IO=STDERR)-class-method","name":"new","abstract":false,"args":[{"name":"task_name","external_name":"task_name","restriction":"String"},{"name":"io","default_value":"STDERR","external_name":"io","restriction":"IO"}],"args_string":"(task_name : String, io : IO = STDERR)","args_html":"(task_name : String, io : IO = STDERR)","location":{"filename":"src/lucky_task/task_not_found_error_message.cr","line_number":4,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/task_not_found_error_message.cr#L4"},"def":{"name":"new","args":[{"name":"task_name","external_name":"task_name","restriction":"String"},{"name":"io","default_value":"STDERR","external_name":"io","restriction":"IO"}],"visibility":"Public","body":"_ = allocate\n_.initialize(task_name, io)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"print:Nil-instance-method","name":"print","abstract":false,"location":{"filename":"src/lucky_task/task_not_found_error_message.cr","line_number":11,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/task_not_found_error_message.cr#L11"},"def":{"name":"print","return_type":"Nil","visibility":"Public","body":"message = \"Task #{@task_name.colorize(:cyan)} not found.\"\nsimilar_task_name.try do |name|\n message = message + (\" Did you mean '#{name}'?\".colorize(:yellow)).to_s\nend\n@io.puts(message)\n"}}]},{"html_id":"lucky_task/LuckyTask/TextHelpers","path":"LuckyTask/TextHelpers.html","kind":"module","full_name":"LuckyTask::TextHelpers","name":"TextHelpers","abstract":false,"locations":[{"filename":"src/lucky_task/text_helpers.cr","line_number":1,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/text_helpers.cr#L1"}],"repository_name":"lucky_task","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"lucky_task/LuckyTask","kind":"module","full_name":"LuckyTask","name":"LuckyTask"},"instance_methods":[{"html_id":"arrow:String-instance-method","name":"arrow","abstract":false,"location":{"filename":"src/lucky_task/text_helpers.cr","line_number":2,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/text_helpers.cr#L2"},"def":{"name":"arrow","return_type":"String","visibility":"Public","body":"\"▸\""}},{"html_id":"green_arrow:Colorize::Object(String)-instance-method","name":"green_arrow","abstract":false,"location":{"filename":"src/lucky_task/text_helpers.cr","line_number":10,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/text_helpers.cr#L10"},"def":{"name":"green_arrow","return_type":"Colorize::Object(String)","visibility":"Public","body":"arrow.colorize(:green)"}},{"html_id":"red_arrow:Colorize::Object(String)-instance-method","name":"red_arrow","abstract":false,"location":{"filename":"src/lucky_task/text_helpers.cr","line_number":6,"url":"https://github.com/luckyframework/lucky_task/blob/1acdb4898eca1b9cab9824131d3ca80de63434ae/src/lucky_task/text_helpers.cr#L6"},"def":{"name":"red_arrow","return_type":"Colorize::Object(String)","visibility":"Public","body":"arrow.colorize(:red)"}}]}]}]}})
\ No newline at end of file
+crystal_doc_search_index_callback({"repository_name":"lucky_task","body":"# Lucky Task\n\nA Crystal library for creating command line tasks to be used with the [LuckyCli](https://github.com/luckyframework/lucky_cli).\n\n## Installation\n\n1. Add the dependency to your `shard.yml`:\n\n ```yaml\n dependencies:\n lucky_task:\n github: luckyframework/lucky_task\n ```\n\n2. Run `shards install`\n\n## Integrating With LuckyCli\n\nCreate a file `tasks.cr` at the root of your project\n\n```crystal\nrequire \"lucky_task\"\n\n# Using `lucky` from the command line will do nothing if you forget this\nLuckyTask::Runner.run\n```\n\n## Creating Tasks\n\nCreate a `tasks` directory in the root of your project.\n\nUpdate your `tasks.cr` file to require all files within that directory for them to be registered with the CLI.\n\n```crystal\n# tasks.cr\nrequire \"lucky_task\"\nrequire \"./tasks/*\"\n```\n\nIn the directory create a file called `send_daily_notifications.cr`.\n\n```crystal\nclass SendDailyNotifications < LuckyTask::Task\n summary \"Send notifications to users\"\n \n # Name is inferred from class name (\"send_daily_notifications\")\n # It can be overridden:\n #\n # task_name \"app.send_daily_notifications\"\n \n def call\n # Code that sends notifications to all your users...\n end\nend\n```\n\n## Contributing\n\n1. Fork it ()\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [matthewmcgarvey](https://github.com/matthewmcgarvey) - creator and maintainer\n","program":{"html_id":"lucky_task/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"locations":[],"repository_name":"lucky_task","program":true,"enum":false,"alias":false,"const":false,"types":[{"html_id":"lucky_task/LuckyTask","path":"LuckyTask.html","kind":"module","full_name":"LuckyTask","name":"LuckyTask","abstract":false,"locations":[{"filename":"src/lucky_task.cr","line_number":5,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task.cr#L5"},{"filename":"src/lucky_task/text_helpers.cr","line_number":1,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/text_helpers.cr#L1"}],"repository_name":"lucky_task","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"VERSION","name":"VERSION","value":"\"0.3.0\""}],"types":[{"html_id":"lucky_task/LuckyTask/Runner","path":"LuckyTask/Runner.html","kind":"class","full_name":"LuckyTask::Runner","name":"Runner","abstract":false,"superclass":{"html_id":"lucky_task/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"lucky_task/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"lucky_task/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/lucky_task/runner.cr","line_number":1,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/runner.cr#L1"}],"repository_name":"lucky_task","program":false,"enum":false,"alias":false,"const":false,"extended_modules":[{"html_id":"lucky_task/LuckyTask/TextHelpers","kind":"module","full_name":"LuckyTask::TextHelpers","name":"TextHelpers"}],"namespace":{"html_id":"lucky_task/LuckyTask","kind":"module","full_name":"LuckyTask","name":"LuckyTask"},"class_methods":[{"html_id":"exit_with_error_if_not_found=(exit_with_error_if_not_found:Bool)-class-method","name":"exit_with_error_if_not_found=","abstract":false,"args":[{"name":"exit_with_error_if_not_found","external_name":"exit_with_error_if_not_found","restriction":"Bool"}],"args_string":"(exit_with_error_if_not_found : Bool)","args_html":"(exit_with_error_if_not_found : Bool)","location":{"filename":"src/lucky_task/runner.cr","line_number":3,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/runner.cr#L3"},"def":{"name":"exit_with_error_if_not_found=","args":[{"name":"exit_with_error_if_not_found","external_name":"exit_with_error_if_not_found","restriction":"Bool"}],"visibility":"Public","body":"@@exit_with_error_if_not_found = exit_with_error_if_not_found"}},{"html_id":"exit_with_error_if_not_found?:Bool-class-method","name":"exit_with_error_if_not_found?","abstract":false,"location":{"filename":"src/lucky_task/runner.cr","line_number":3,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/runner.cr#L3"},"def":{"name":"exit_with_error_if_not_found?","return_type":"Bool","visibility":"Public","body":"@@exit_with_error_if_not_found"}},{"html_id":"find_task(task_name:String):LuckyTask::Task|Nil-class-method","name":"find_task","abstract":false,"args":[{"name":"task_name","external_name":"task_name","restriction":"String"}],"args_string":"(task_name : String) : LuckyTask::Task | Nil","args_html":"(task_name : String) : LuckyTask::Task | Nil","location":{"filename":"src/lucky_task/runner.cr","line_number":49,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/runner.cr#L49"},"def":{"name":"find_task","args":[{"name":"task_name","external_name":"task_name","restriction":"String"}],"return_type":"LuckyTask::Task | ::Nil","visibility":"Public","body":"found_task = @@tasks.find do |task|\n task.task_name == task_name\nend\nif found_task\n found_task.new\nend\n"}},{"html_id":"help_text:Nil-class-method","name":"help_text","abstract":false,"location":{"filename":"src/lucky_task/runner.cr","line_number":39,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/runner.cr#L39"},"def":{"name":"help_text","return_type":"Nil","visibility":"Public","body":"puts(\"Usage: lucky name.of.task [options]\\n\\nAvailable tasks:\\n\\n#{tasks_list}\")"}},{"html_id":"list_padding_for(task_name):String-class-method","name":"list_padding_for","abstract":false,"args":[{"name":"task_name","external_name":"task_name","restriction":""}],"args_string":"(task_name) : String","args_html":"(task_name) : String","location":{"filename":"src/lucky_task/runner.cr","line_number":67,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/runner.cr#L67"},"def":{"name":"list_padding_for","args":[{"name":"task_name","external_name":"task_name","restriction":""}],"return_type":"String","visibility":"Public","body":"\" \" * ((longest_task_name - task_name.size) + 2)"}},{"html_id":"longest_task_name:Int32-class-method","name":"longest_task_name","abstract":false,"location":{"filename":"src/lucky_task/runner.cr","line_number":71,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/runner.cr#L71"},"def":{"name":"longest_task_name","return_type":"Int32","visibility":"Public","body":"tasks.max_of() do |__arg1|\n __arg1.task_name.size\nend"}},{"html_id":"register_task(task:LuckyTask::Task.class):Nil-class-method","name":"register_task","abstract":false,"args":[{"name":"task","external_name":"task","restriction":"LuckyTask::Task.class"}],"args_string":"(task : LuckyTask::Task.class) : Nil","args_html":"(task : LuckyTask::Task.class) : Nil","location":{"filename":"src/lucky_task/runner.cr","line_number":7,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/runner.cr#L7"},"def":{"name":"register_task","args":[{"name":"task","external_name":"task","restriction":"LuckyTask::Task.class"}],"return_type":"Nil","visibility":"Public","body":"@@tasks.push(task)"}},{"html_id":"run(args=ARGV,io:IO=STDERR)-class-method","name":"run","abstract":false,"args":[{"name":"args","default_value":"ARGV","external_name":"args","restriction":""},{"name":"io","default_value":"STDERR","external_name":"io","restriction":"IO"}],"args_string":"(args = ARGV, io : IO = STDERR)","args_html":"(args = ARGV, io : IO = STDERR)","location":{"filename":"src/lucky_task/runner.cr","line_number":15,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/runner.cr#L15"},"def":{"name":"run","args":[{"name":"args","default_value":"ARGV","external_name":"args","restriction":""},{"name":"io","default_value":"STDERR","external_name":"io","restriction":"IO"}],"visibility":"Public","body":"task_name = args.shift?\nif (!task_name.nil?) && ({\"--help\", \"-h\"}.includes?(task_name))\n puts(help_text)\nelse\n if task_name.nil?\n io.puts(\"Missing a task name\\n\\nTo see a list of available tasks, run #{\"lucky tasks\".colorize(:green)}\")\n else\n if task = find_task(task_name)\n task.output = io\n task.print_help_or_call(args)\n else\n TaskNotFoundErrorMessage.print(task_name)\n if exit_with_error_if_not_found?\n exit(127)\n end\n end\n end\nend\n"}},{"html_id":"tasks:Array(LuckyTask::Task.class)-class-method","name":"tasks","abstract":false,"location":{"filename":"src/lucky_task/runner.cr","line_number":11,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/runner.cr#L11"},"def":{"name":"tasks","return_type":"Array(LuckyTask::Task.class)","visibility":"Public","body":"@@tasks.sort_by!(&.task_name)"}},{"html_id":"tasks_list:String-class-method","name":"tasks_list","abstract":false,"location":{"filename":"src/lucky_task/runner.cr","line_number":56,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/runner.cr#L56"},"def":{"name":"tasks_list","return_type":"String","visibility":"Public","body":"String.build do |list|\n tasks.each do |task|\n list << ((\" #{arrow} \" + task.task_name).colorize(:green))\n list << (list_padding_for(task.task_name))\n list << task.task_summary\n list << \"\\n\"\n end\nend"}}]},{"html_id":"lucky_task/LuckyTask/Task","path":"LuckyTask/Task.html","kind":"class","full_name":"LuckyTask::Task","name":"Task","abstract":true,"superclass":{"html_id":"lucky_task/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"lucky_task/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"lucky_task/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/lucky_task/task.cr","line_number":1,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/task.cr#L1"}],"repository_name":"lucky_task","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"lucky_task/LuckyTask","kind":"module","full_name":"LuckyTask","name":"LuckyTask"},"instance_methods":[{"html_id":"call-instance-method","name":"call","abstract":true,"location":{"filename":"src/lucky_task/task.cr","line_number":295,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/task.cr#L295"},"def":{"name":"call","visibility":"Public","body":""}}],"macros":[{"html_id":"arg(arg_name,description,shortcut=nil,optional=false,format=nil,example=nil)-macro","name":"arg","doc":"Creates a method of `arg_name` that returns the value passed in from the CLI.\nThe CLI arg is specified by the `--arg_name=VALUE` flag.\n\n* `arg_name` : String - The name of the argument\n* `description` : String - The help text description for this option\n* `shorcut` : String - An optional short flag (e.g. -a VALUE)\n* `optional` : Bool - When false, raise exception if this arg is not passed\n* `format` : Regex - The format you expect the args to match\n* `example` : String - An example string that matches the given `format`","summary":"Creates a method of arg_name
that returns the value passed in from the CLI.
","abstract":false,"args":[{"name":"arg_name","external_name":"arg_name","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"shortcut","default_value":"nil","external_name":"shortcut","restriction":""},{"name":"optional","default_value":"false","external_name":"optional","restriction":""},{"name":"format","default_value":"nil","external_name":"format","restriction":""},{"name":"example","default_value":"nil","external_name":"example","restriction":""}],"args_string":"(arg_name, description, shortcut = nil, optional = false, format = nil, example = nil)","args_html":"(arg_name, description, shortcut = nil, optional = false, format = nil, example = nil)","location":{"filename":"src/lucky_task/task.cr","line_number":152,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/task.cr#L152"},"def":{"name":"arg","args":[{"name":"arg_name","external_name":"arg_name","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"shortcut","default_value":"nil","external_name":"shortcut","restriction":""},{"name":"optional","default_value":"false","external_name":"optional","restriction":""},{"name":"format","default_value":"nil","external_name":"format","restriction":""},{"name":"example","default_value":"nil","external_name":"example","restriction":""}],"visibility":"Public","body":" \n{% PARSER_OPTS << arg_name %}\n\n @\n{{ arg_name.id }}\n : String?\n\n def set_opt_for_\n{{ arg_name.id }}\n(unused_args : Array(String))\n option_parser.on(\n \n{% if shortcut %}\"{{ shortcut.id }} {{ arg_name.stringify.upcase.id }}\",{% end %}\n\n \"--\n{{ (arg_name.id.stringify.underscore.gsub(/_/, \"-\")).id }}\n=\n{{ arg_name.id.stringify.upcase.id }}\n\",\n \n{{ description }}\n\n ) do |value|\n value = value.strip\n \n{% if format %}\n if value !~ {{ format }}\n raise <<-ERROR\n Invalid format for {{ arg_name.id }}. It should match {{ format }}\n {% if example %}\n Example: {{ example.id }}\n {% end %}\n ERROR\n end\n {% end %}\n\n @\n{{ arg_name.id }}\n = value\n \nend\n \nend\n\n def \n{{ arg_name.id }}\n : String\n{% if optional %}?{% end %}\n\n \n{% if !optional %}\n if @{{ arg_name.id }}.nil?\n raise <<-ERROR\n {{ arg_name.id }} is required, but no value was passed.\n\n Try this...\n\n {% if shortcut %}{{ shortcut.id }} SOME_VALUE{% end %}\n --{{ (arg_name.id.stringify.underscore.gsub(/_/, \"-\")).id }}=SOME_VALUE\n ERROR\n end\n @{{ arg_name.id }}.as(String)\n {% else %}\n @{{ arg_name.id }}\n {% end %}\n\n \nend\n \n"}},{"html_id":"float64(arg_name,description,shortcut=nil,default=nil)-macro","name":"float64","doc":"Creates a method of `arg_name` where the return value is an Float64.\nIf the flag `--arg_name` is passed, the result is the value passed, otherwise is set to\nthe specified default, or `0.0` when not specified.\n\n* `arg_name` : String - The name of the argument\n* `description` : String - The help text description for this option\n* `shorcut` : String - An optional short flag (e.g. `-a`)\n* `default` : Float64 - An optional default value (`0.0` is default when omittted)\n\nExample:\n float64 :threshold, \"(0.1, 3.14, -5.1, etc.)\", shortcut: \"-t\", default: 2.0","summary":"Creates a method of arg_name
where the return value is an Float64.
","abstract":false,"args":[{"name":"arg_name","external_name":"arg_name","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"shortcut","default_value":"nil","external_name":"shortcut","restriction":""},{"name":"default","default_value":"nil","external_name":"default","restriction":""}],"args_string":"(arg_name, description, shortcut = nil, default = nil)","args_html":"(arg_name, description, shortcut = nil, default = nil)","location":{"filename":"src/lucky_task/task.cr","line_number":269,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/task.cr#L269"},"def":{"name":"float64","args":[{"name":"arg_name","external_name":"arg_name","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"shortcut","default_value":"nil","external_name":"shortcut","restriction":""},{"name":"default","default_value":"nil","external_name":"default","restriction":""}],"visibility":"Public","body":" \n{% PARSER_OPTS << arg_name %}\n\n @\n{{ arg_name.id }}\n : Float64 = \n{{ default || 0.0 }}\n\n\n def set_opt_for_\n{{ arg_name.id }}\n(unused_args : Array(String))\n option_parser.on(\n \n{% if shortcut %}\"{{ shortcut.id }} {{ arg_name.stringify.upcase.id }}\",{% end %}\n\n \"--\n{{ (arg_name.id.stringify.underscore.gsub(/_/, \"-\")).id }}\n=\n{{ arg_name.id.stringify.upcase.id }}\n\",\n \n{{ description }}\n\n ) do |value|\n value = value.strip.gsub(\"_\", \"\")\n if value !~ /^[+-]?([0-9]*[.])?[0-9]+$/\n raise <<-ERROR\n #{value.inspect} is an invalid value for \n{{ arg_name.id }}\n. It should be a valid Float64\n Examples: 1 or 1.0 or 1_000.0 or -1.0\n ERROR\n \nend\n @\n{{ arg_name.id }}\n = value.to_f64\n \nend\n \nend\n\n def \n{{ arg_name.id }}\n : Float64\n @\n{{ arg_name.id }}\n\n \nend\n \n"}},{"html_id":"help_message(help_text)-macro","name":"help_message","doc":"Customize your help message with the provided `help_text`\n\n```\nclass KeyGen < LuckyTask::Task\n summary \"Generate a new key\"\n help_message \"Call lucky key_gen to generate a new key\"\n\n # other methods, etc.\nend\n```","summary":"Customize your help message with the provided help_text
","abstract":false,"args":[{"name":"help_text","external_name":"help_text","restriction":""}],"args_string":"(help_text)","args_html":"(help_text)","location":{"filename":"src/lucky_task/task.cr","line_number":92,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/task.cr#L92"},"def":{"name":"help_message","args":[{"name":"help_text","external_name":"help_text","restriction":""}],"visibility":"Public","body":" def self.task_help_message : String\n \n{{ help_text }}\n\n \nend\n \n"}},{"html_id":"int32(arg_name,description,shortcut=nil,default=nil)-macro","name":"int32","doc":"Creates a method of `arg_name` where the return value is an Int32.\nIf the flag `--arg_name` is passed, the result is the value passed, otherwise is set to\nthe specified default, or `0` when not specified.\n\n* `arg_name` : String - The name of the argument\n* `description` : String - The help text description for this option\n* `shorcut` : String - An optional short flag (e.g. `-a`)\n* `default` : Int32 - An optional default value (`0` is default when omittted)\n\nExample:\n int32 :limit, \"limit (1000, 10_000, etc.)\", shortcut: \"-l\", default: 1_000","summary":"Creates a method of arg_name
where the return value is an Int32.
","abstract":false,"args":[{"name":"arg_name","external_name":"arg_name","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"shortcut","default_value":"nil","external_name":"shortcut","restriction":""},{"name":"default","default_value":"nil","external_name":"default","restriction":""}],"args_string":"(arg_name, description, shortcut = nil, default = nil)","args_html":"(arg_name, description, shortcut = nil, default = nil)","location":{"filename":"src/lucky_task/task.cr","line_number":232,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/task.cr#L232"},"def":{"name":"int32","args":[{"name":"arg_name","external_name":"arg_name","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"shortcut","default_value":"nil","external_name":"shortcut","restriction":""},{"name":"default","default_value":"nil","external_name":"default","restriction":""}],"visibility":"Public","body":" \n{% PARSER_OPTS << arg_name %}\n\n @\n{{ arg_name.id }}\n : Int32 = \n{{ default || 0 }}\n\n\n def set_opt_for_\n{{ arg_name.id }}\n(unused_args : Array(String))\n option_parser.on(\n \n{% if shortcut %}\"{{ shortcut.id }} {{ arg_name.stringify.upcase.id }}\",{% end %}\n\n \"--\n{{ (arg_name.id.stringify.underscore.gsub(/_/, \"-\")).id }}\n=\n{{ arg_name.id.stringify.upcase.id }}\n\",\n \n{{ description }}\n\n ) do |value|\n value = value.strip\n if value !~ /^[\\+\\-]?[0-9\\_]+$/\n raise <<-ERROR\n #{value.inspect} is an invalid value for \n{{ arg_name.id }}\n. It should be a valid Int32\n Examples: 1 or 1000 or 10_000 or -1\n ERROR\n \nend\n @\n{{ arg_name.id }}\n = value.gsub(/[\\_]/, \"\").to_i32\n \nend\n \nend\n\n def \n{{ arg_name.id }}\n : Int32\n @\n{{ arg_name.id }}\n\n \nend\n \n"}},{"html_id":"name(name_text)-macro","name":"name","doc":"Renames the task name for CLI use\n\nBy default the task name is derived from the full module and class name.\nHowever if that task name is not desired, a custom one can be set.\n\n```\nclass Dev::Prime < LuckyTask::Task\n # Would be \"dev.prime\" by default, but we want to set it to \"dev.setup\":\n task_name \"dev.setup\"\n summary \"Seed the development database with example data\"\n\n # other methods, etc.\nend\n```","summary":"Renames the task name for CLI use
","abstract":false,"args":[{"name":"name_text","external_name":"name_text","restriction":""}],"args_string":"(name_text)","args_html":"(name_text)","location":{"filename":"src/lucky_task/task.cr","line_number":76,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/task.cr#L76"},"def":{"name":"name","args":[{"name":"name_text","external_name":"name_text","restriction":""}],"visibility":"Public","body":" def self.task_name : String\n \n{{ name_text }}\n\n \nend\n \n"}},{"html_id":"positional_arg(arg_name,description,to_end=false,format=nil,example=nil)-macro","name":"positional_arg","doc":"Creates a method of `arg_name` that returns the value passed in from the CLI.\nThe CLI arg position is based on the order in which `positional_arg` is specified\nwith the first call being position 0, and so on.\n\nIf your arg takes more than one value, you can set `to_end` to true to capture all\nargs from this position to the end. This will make your `arg_name` method return `Array(String)`.\n\n* `arg_name` : String - The name of the argument\n* `description` : String - The help text description for this option\n* `to_end` : Bool - Capture all args from this position to the end.\n* `format` : Regex - The format you expect the args to match\n* `example` : String - An example string that matches the given `format`","summary":"Creates a method of arg_name
that returns the value passed in from the CLI.
","abstract":false,"args":[{"name":"arg_name","external_name":"arg_name","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"to_end","default_value":"false","external_name":"to_end","restriction":""},{"name":"format","default_value":"nil","external_name":"format","restriction":""},{"name":"example","default_value":"nil","external_name":"example","restriction":""}],"args_string":"(arg_name, description, to_end = false, format = nil, example = nil)","args_html":"(arg_name, description, to_end = false, format = nil, example = nil)","location":{"filename":"src/lucky_task/task.cr","line_number":110,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/task.cr#L110"},"def":{"name":"positional_arg","args":[{"name":"arg_name","external_name":"arg_name","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"to_end","default_value":"false","external_name":"to_end","restriction":""},{"name":"format","default_value":"nil","external_name":"format","restriction":""},{"name":"example","default_value":"nil","external_name":"example","restriction":""}],"visibility":"Public","body":" \n{% PARSER_OPTS << arg_name %}\n\n @\n{{ arg_name.id }}\n : \n{% if to_end %}Array(String){% else %}String{% end %}\n | Nil\n\n def set_opt_for_\n{{ arg_name.id }}\n(args : Array(String))\n \n{% if to_end %}\n value = args[@positional_arg_count..-1]\n {% else %}\n value = args[@positional_arg_count]?\n {% end %}\n\n \n{% if format %}\n matches = value.is_a?(Array) ? value.all?(&.=~({{ format }})) : value =~ {{ format }}\n if !matches\n raise <<-ERROR\n Invalid format for {{ arg_name.id }}. It should match {{ format }}\n {% if example %}\n Example: {{ example.id }}\n {% end %}\n ERROR\n end\n {% end %}\n\n @\n{{ arg_name.id }}\n = value\n @positional_arg_count += 1\n \nend\n\n def \n{{ arg_name.id }}\n : \n{% if to_end %}Array(String){% else %}String{% end %}\n\n if @\n{{ arg_name.id }}\n.nil?\n raise \"\n{{ arg_name.id }}\n is required, but no value was passed.\"\n \nend\n @\n{{ arg_name.id }}\n.as(\n{% if to_end %}Array(String){% else %}String{% end %}\n)\n \nend\n \n"}},{"html_id":"summary(summary_text)-macro","name":"summary","doc":"The general description of what this task does\n\nThis is used in the help_text when a help flag is passed\nto the task through the CLI","summary":"The general description of what this task does
","abstract":false,"args":[{"name":"summary_text","external_name":"summary_text","restriction":""}],"args_string":"(summary_text)","args_html":"(summary_text)","location":{"filename":"src/lucky_task/task.cr","line_number":56,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/task.cr#L56"},"def":{"name":"summary","args":[{"name":"summary_text","external_name":"summary_text","restriction":""}],"visibility":"Public","body":" def self.task_summary : String\n \n{{ summary_text }}\n\n \nend\n \n"}},{"html_id":"switch(arg_name,description,shortcut=nil)-macro","name":"switch","doc":"Creates a method of `arg_name` where the return value is boolean.\nIf the flag `--arg_name` is passed, the value is `true`.\n\n* `arg_name` : String - The name of the argument\n* `description` : String - The help text description for this option\n* `shorcut` : String - An optional short flag (e.g. `-a`)","summary":"Creates a method of arg_name
where the return value is boolean.
","abstract":false,"args":[{"name":"arg_name","external_name":"arg_name","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"shortcut","default_value":"nil","external_name":"shortcut","restriction":""}],"args_string":"(arg_name, description, shortcut = nil)","args_html":"(arg_name, description, shortcut = nil)","location":{"filename":"src/lucky_task/task.cr","line_number":202,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/task.cr#L202"},"def":{"name":"switch","args":[{"name":"arg_name","external_name":"arg_name","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"shortcut","default_value":"nil","external_name":"shortcut","restriction":""}],"visibility":"Public","body":" \n{% PARSER_OPTS << arg_name %}\n\n @\n{{ arg_name.id }}\n : Bool = false\n\n def set_opt_for_\n{{ arg_name.id }}\n(unused_args : Array(String))\n option_parser.on(\n \n{% if shortcut %}\"{{ shortcut.id }}\",{% end %}\n\n \"--\n{{ (arg_name.id.stringify.underscore.gsub(/_/, \"-\")).id }}\n\",\n \n{{ description }}\n\n ) do\n @\n{{ arg_name.id }}\n = true\n \nend\n \nend\n\n def \n{{ arg_name.id }}\n? : Bool\n @\n{{ arg_name.id }}\n\n \nend\n \n"}}]},{"html_id":"lucky_task/LuckyTask/TaskNotFoundErrorMessage","path":"LuckyTask/TaskNotFoundErrorMessage.html","kind":"class","full_name":"LuckyTask::TaskNotFoundErrorMessage","name":"TaskNotFoundErrorMessage","abstract":false,"superclass":{"html_id":"lucky_task/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"lucky_task/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"lucky_task/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/lucky_task/task_not_found_error_message.cr","line_number":3,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/task_not_found_error_message.cr#L3"}],"repository_name":"lucky_task","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"lucky_task/LuckyTask","kind":"module","full_name":"LuckyTask","name":"LuckyTask"},"class_methods":[{"html_id":"print(*args):Nil-class-method","name":"print","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args) : Nil","args_html":"(*args) : Nil","location":{"filename":"src/lucky_task/task_not_found_error_message.cr","line_number":7,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/task_not_found_error_message.cr#L7"},"def":{"name":"print","args":[{"name":"args","external_name":"args","restriction":""}],"splat_index":0,"return_type":"Nil","visibility":"Public","body":"(new(*args)).print"}}],"constructors":[{"html_id":"new(task_name:String,io:IO=STDERR)-class-method","name":"new","abstract":false,"args":[{"name":"task_name","external_name":"task_name","restriction":"String"},{"name":"io","default_value":"STDERR","external_name":"io","restriction":"IO"}],"args_string":"(task_name : String, io : IO = STDERR)","args_html":"(task_name : String, io : IO = STDERR)","location":{"filename":"src/lucky_task/task_not_found_error_message.cr","line_number":4,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/task_not_found_error_message.cr#L4"},"def":{"name":"new","args":[{"name":"task_name","external_name":"task_name","restriction":"String"},{"name":"io","default_value":"STDERR","external_name":"io","restriction":"IO"}],"visibility":"Public","body":"_ = allocate\n_.initialize(task_name, io)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"print:Nil-instance-method","name":"print","abstract":false,"location":{"filename":"src/lucky_task/task_not_found_error_message.cr","line_number":11,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/task_not_found_error_message.cr#L11"},"def":{"name":"print","return_type":"Nil","visibility":"Public","body":"message = \"Task #{@task_name.colorize(:cyan)} not found.\"\nsimilar_task_name.try do |name|\n message = message + (\" Did you mean '#{name}'?\".colorize(:yellow)).to_s\nend\n@io.puts(message)\n"}}]},{"html_id":"lucky_task/LuckyTask/TextHelpers","path":"LuckyTask/TextHelpers.html","kind":"module","full_name":"LuckyTask::TextHelpers","name":"TextHelpers","abstract":false,"locations":[{"filename":"src/lucky_task/text_helpers.cr","line_number":1,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/text_helpers.cr#L1"}],"repository_name":"lucky_task","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"lucky_task/LuckyTask","kind":"module","full_name":"LuckyTask","name":"LuckyTask"},"instance_methods":[{"html_id":"arrow:String-instance-method","name":"arrow","abstract":false,"location":{"filename":"src/lucky_task/text_helpers.cr","line_number":2,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/text_helpers.cr#L2"},"def":{"name":"arrow","return_type":"String","visibility":"Public","body":"\"▸\""}},{"html_id":"green_arrow:Colorize::Object(String)-instance-method","name":"green_arrow","abstract":false,"location":{"filename":"src/lucky_task/text_helpers.cr","line_number":10,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/text_helpers.cr#L10"},"def":{"name":"green_arrow","return_type":"Colorize::Object(String)","visibility":"Public","body":"arrow.colorize(:green)"}},{"html_id":"red_arrow:Colorize::Object(String)-instance-method","name":"red_arrow","abstract":false,"location":{"filename":"src/lucky_task/text_helpers.cr","line_number":6,"url":"https://github.com/luckyframework/lucky_task/blob/8405c04cc9537343d47a394c65114240799138fd/src/lucky_task/text_helpers.cr#L6"},"def":{"name":"red_arrow","return_type":"Colorize::Object(String)","visibility":"Public","body":"arrow.colorize(:red)"}}]}]}]}})
\ No newline at end of file