crystal_doc_search_index_callback({"repository_name":"CliGenerator","body":"# cligen\n\nA Crystal shard that generates CLI parsers from class definitions using annotations and macros. Define your commands as classes; cligen builds the runtime parse tree.\n\n## How It Works\n\nSubclass `CliGen::Command`, annotate your instance variables with `@[CliGen::Argument]`, and register the command with an `CliGen::App`. At compile time, macros inspect the annotations and generate typed `Flag(T)` objects; at runtime, `CliGen::App.process` walks the `CommandNode` tree to route arguments, populate your command instance, and dispatch to the right method.\n\n## Installation\n\n1. Add the dependency to your `shard.yml`:\n\n ```yaml\n dependencies:\n cligen:\n git: https://git.arcanium.tech/tristan/cligen\n ```\n\n2. Run `shards install`\n\n## Usage\n\n```crystal\nrequire \"cligen\"\n\n@[CliGen::CommandInfo(description: \"Greet someone\")]\nclass Greet < CliGen::Command\n @[CliGen::Argument(short: \"-n\", long: \"--name VALUE\", description: \"Name to greet\")]\n @name : String = \"world\"\n \n argument(otherval : String = \"abc\",\n long: \"--other\",\n short: \"-o\",\n options: %w[ abc def ghi ],\n description: \"This provides a way of setting the second string taht is printed\"\n )\n \n argument(myvars : Array(String) = [ \"a\" ],\n short: \"-m\",\n options: %w[ a b c ],\n description: \"Provide multiple things to be printed out in the main function\"\n )\n\n def main\n puts \"1) Hello, #{@name}!\"\n puts \"2) #{@otherval}\"\n @myvars.each_with_index do |var, index|\n puts \"%d) %s\" % [ 3 + index, var ]\n end\n end\nend\n\nCliGen::App.process\n```\n\n```\n$ myapp greet --name Alice -m a a -m a,a,b\n1) Hello, Alice!\n2) abc\n3) a \n4) a \n5) a \n6) a \n7) b\n```\n\nFull API documentation and design notes are in [`design.adoc`](design.adoc).\n\n## Architecture\n\nAs a short overview, this projects makes HEAVY use of Crystal macros to learn the shape of your project & command subclasses.\n\nSubclassing to `CliGen::Command` injects macros into your class that provides you user friendly DSLs/Macros for defining arguments/flags & subcommands. This is later used in the library `src/cligen/app/generate.cr` to generate a object graph of your commands and all annotated \"arguments/flags\" and stores them in a tree from the App object itself.\n\nThis allows the project to \"learn\" your project & generate a command tree from the defined data.\n\nThe MAJORITY of stdlib types (Int*, Float*, String, Bool & Time) are all supported in-place (as these are the primary data-types you might try to comsume from the CLI. However, custom data types are supported provided you extend the class's metaclass with `CliGen::Coercable` && `CliGen::Parsable` modules and define the `self.parse_args(args : Array(CliGen::Arg)` and `self.coerce(arg : String)` class methods.\n\nEX:\n```crystal\nmodule MyModule\n class MyData\n extend CliGen::Parsable\n extend CliGen::Coercable\n \n @value : Int32\n \n def initialize(value : String)\n @value = value.to_i32\n end\n \n def self.parse_args(args : Array(CliGen::Arg))\n arg = args.first\n # Mark the argument as processed\n arg.processed\n new(arg.value)\n \n end\n \n def self.coerce(arg : String)\n new(arg)\n end\n end\nend\n```\n\n\nCoercable Method:\n-----------------\n```crystal\n def self.coerce(arg : String)\n new(arg)\n end\n```\n\nThe coerce method provides you the ability to parse a single string value into your class/datatype. This is generally only used when parsing from ENV VAR and when being used by parsing from an Array(T) type. \n\nThis should only be used in the case you need a simple datatype that can be learned from a single string.\n\nParsable Method:\n----------------\n```crystal\n def self.parse_args(args : Array(CliGen::Arg))\n arg = args.first\n # Mark the argument as processed (required)\n arg.processed\n new(arg.value)\n end\n```\n\nThis method is used the most and is used for when using the bare class as the generic type in the Flag(T). With this the Flag(T) will collect all provided arguments (cli arguments that weren't determined to be flags or subcommands) and pass them to your parse_args method so that you can parse them how you see fit and determine if the args provided by the user are enough and to be able to raise if data is not provided correctly/in the right format.\n\nThis gives the framework a way to allow you to extend the parser in your own custom way to allow for a \"custom\" format to be procesed. However, it's very strict and you MUST properly mark the arguments as processed so that the mainloop won't double-process arguments passed to your custom parser. However, this won't happen as in the Flag(T) I am doing a check to ensure that args were processed after passing it to your code.\n\n## Development\n\n```bash\n# Type-check without running\ncrystal build src/cligen.cr --no-codegen\n\n# Run specs\ncrystal spec\n```\n\n## AI Assistance Disclosure\n\nThis project uses [Claude Code](https://claude.ai/code) as a development aid — specifically for catching bugs, spotting typos, reviewing implementations, and talking through design decisions. All architecture decisions, code, and design are written by the author. Claude is used the way one might use a second pair of eyes on a diff, not as a code generator.\n\n`CLAUDE.md` at the repo root documents the project structure for Claude's context. `.claude/` holds project-level Claude Code settings.\n\n## Contributors\n\n- [Tristan Ancelet](https://git.arcanium.tech/tristan) - creator and maintainer\n","program":{"html_id":"CliGenerator/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"locations":[],"repository_name":"CliGenerator","program":true,"enum":false,"alias":false,"const":false,"types":[{"html_id":"CliGenerator/CliGen","path":"CliGen.html","kind":"module","full_name":"CliGen","name":"CliGen","abstract":false,"locations":[{"filename":"src/cligen.cr","line_number":16,"url":null},{"filename":"src/cligen/annotations.cr","line_number":4,"url":null},{"filename":"src/cligen/app.cr","line_number":9,"url":null},{"filename":"src/cligen/app/generate.cr","line_number":4,"url":null},{"filename":"src/cligen/arg.cr","line_number":4,"url":null},{"filename":"src/cligen/command.cr","line_number":18,"url":null},{"filename":"src/cligen/command/argument.cr","line_number":4,"url":null},{"filename":"src/cligen/command/define_command_initializer.cr","line_number":4,"url":null},{"filename":"src/cligen/command/define_singleton_init.cr","line_number":4,"url":null},{"filename":"src/cligen/command/generate_gather_handler.cr","line_number":1,"url":null},{"filename":"src/cligen/command/generate_register_command.cr","line_number":2,"url":null},{"filename":"src/cligen/command/help_template.cr","line_number":4,"url":null},{"filename":"src/cligen/command/resolve_value.cr","line_number":1,"url":null},{"filename":"src/cligen/command/subcommand.cr","line_number":4,"url":null},{"filename":"src/cligen/command/validate_command_tree.cr","line_number":1,"url":null},{"filename":"src/cligen/command_node.cr","line_number":13,"url":null},{"filename":"src/cligen/command_node/base.cr","line_number":8,"url":null},{"filename":"src/cligen/command_node/command_meta.cr","line_number":4,"url":null},{"filename":"src/cligen/command_node/subcommand_meta.cr","line_number":4,"url":null},{"filename":"src/cligen/exceptions.cr","line_number":4,"url":null},{"filename":"src/cligen/flag.cr","line_number":9,"url":null},{"filename":"src/cligen/flag/base.cr","line_number":8,"url":null},{"filename":"src/cligen/flag/meta.cr","line_number":4,"url":null},{"filename":"src/cligen/global_flag.cr","line_number":7,"url":null},{"filename":"src/cligen/global_flag/add_global_flag.cr","line_number":6,"url":null},{"filename":"src/cligen/match_type.cr","line_number":4,"url":null}],"repository_name":"CliGenerator","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"APPNAME","name":"APPNAME","value":"File.basename(PROGRAM_NAME)"},{"id":"GLOBAL_FLAGS","name":"GLOBAL_FLAGS","value":"[] of BaseFlag"},{"id":"MAX_COMMAND_DEPTH","name":"MAX_COMMAND_DEPTH","value":"32","doc":"# CliGen::MAX_COMMAND_DEPTH\n\nThis exists to prevent the user from defining a command tree\nthat extends past the compile-time configured max via the\nCliGen::MAX_COMMAND_DEPTH constant. \n\nThe reason this is a thing is because crystal macros don't allow for \nunbounded while's/until's in macros, meaning it always has to be \ndeterministic. SO to deal with this and still allow for subcommand\ndefining you need either go with the default (32 command depth) or\ndefine your own larger max (understand this will affect compile-time\ndue to this directly affecting loops in the Command macros).\n\nSo to still support this I had to make bounded for-loops usng\n\n\n {% for i in (1..CliGen::MAX_COMMAND_DEPTH) %}\n ...do checks...\n {% end }\n\n","summary":"
This macro provides a user-friendly way to define a global flag for your project.
","abstract":false,"args":[{"name":"type","external_name":"type","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"long","external_name":"long","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"env_var","default_value":"\"\"","external_name":"env_var","restriction":""},{"name":"short","default_value":"nil","external_name":"short","restriction":""},{"name":"validation","default_value":"nil","external_name":"validation","restriction":""},{"name":"default","default_value":"nil","external_name":"default","restriction":""},{"name":"on_match","default_value":"nil","external_name":"on_match","restriction":""},{"name":"options","default_value":"nil","external_name":"options","restriction":""},{"name":"format","default_value":"nil","external_name":"format","restriction":""},{"name":"internal","default_value":"false","external_name":"internal","restriction":""}],"args_string":"(type, *, long, description, env_var = \"\", short = nil, validation = nil, default = nil, on_match = nil, options = nil, format = nil, internal = false)","args_html":"(type, *, long, description, env_var = "", short = nil, validation = nil, default = nil, on_match = nil, options = nil, format = nil, internal = false)","location":{"filename":"src/cligen/global_flag/add_global_flag.cr","line_number":248,"url":null},"def":{"name":"add_global_flag","args":[{"name":"type","external_name":"type","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"long","external_name":"long","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"env_var","default_value":"\"\"","external_name":"env_var","restriction":""},{"name":"short","default_value":"nil","external_name":"short","restriction":""},{"name":"validation","default_value":"nil","external_name":"validation","restriction":""},{"name":"default","default_value":"nil","external_name":"default","restriction":""},{"name":"on_match","default_value":"nil","external_name":"on_match","restriction":""},{"name":"options","default_value":"nil","external_name":"options","restriction":""},{"name":"format","default_value":"nil","external_name":"format","restriction":""},{"name":"internal","default_value":"false","external_name":"internal","restriction":""}],"splat_index":1,"visibility":"Public","body":" \n{% unless long.is_a?(StringLiteral)\n raise(\"ERROR : CliGen.add_global_flag : Provided long must be a string\")\nend %}\n\n \n{% if env_var == \"\"\n env_var = ((long.gsub(/^--/, \"\")).gsub(/-+/, \"_\")).upcase\nend %}\n\n\n CliGen::Common.check_flag_vars(\n raise_base: \n{{ \"CliGen.add_global_flag(#{long.id})\" }}\n,\n type: \n{{ type }}\n,\n long: \n{{ long }}\n,\n \nenv_var: \n{{ env_var }}\n,\n short: \n{{ short }}\n,\n validation: \n{{ validation }}\n,\n on_match: \n{{ on_match }}\n,\n options: \n{{ options }}\n,\n format: \n{{ format }}\n,\n description: \n{{ description }}\n,\n internal: \n{{ internal }}\n\n )\n\n \n%flg\n = ::CliGen::Flag(\n{{ type }}\n).new( \n var: \"\",\n short: \n{{ short }}\n,\n long: \n{{ long }}\n,\n description: \n{{ description }}\n,\n \nenv_var: \n{{ env_var }}\n,\n default: \n{{ default }}\n,\n options: \n{% if options.nil? %} nil {% elsif type.resolve < Array %} [{{ options }}] {% else %} {{ options }} {% end %}\n,\n on_match: \n{% unless on_match.nil? %} {{ on_match }} {% else %} nil {% end %}\n,\n validate: \n{% unless validation.nil? %} {{ validation }} {% else %} nil {% end %}\n\n )\n\n \n# If the user is defining a global flag check to make sure that long\n\n \n# isn't already defined\n\n if \n%oflg\n = ::CliGen::GLOBAL_FLAGS.find(&.long_key.== \n%flg\n.long_key)\n abort <<-EOF\n ERROR : CliGen.add_global_flag : Flag(\n{{ type }}\n, long: \"\n{{ long.id }}\n\") : at #{__FILE__}:#{__LINE__}\n\n Provided long flag (#{\n%flg\n.long_key}) is in conflict with another flag in CliGen::GLOBAL_FLAGS. \n\n You will need to choose another long.\n\n Conflicted Flag:\n Flag(#{\n%oflg\n.meta.type}, long: \"#{\n%oflg\n.long}\", description: \"#{\n%oflg\n.description}\")\n \\n\n EOF\n \nend\n\n \n{% unless short.nil? %}\n # If the user is defining a global flag check to make sure that short\n # isn't already defined\n if %oflg = ::CliGen::GLOBAL_FLAGS.find(&.short.== %flg.short)\n abort <<-EOF\n ERROR : CliGen.add_global_flag : Flag({{ type }}, long: \"{{ long.id }}\") : at #{__FILE__}:#{__LINE__}\n \n Provided short flag (#{%flg.short}) is in conflict with another flag in CliGen::GLOBAL_FLAGS. \n\n You will need to choose another short.\n\n Conflicted Flag:\n Flag(#{%oflg.meta.type}, long: \"#{%oflg.long}\", description: \"#{%oflg.description}\")\n \\n\n EOF\n end\n {% end %}\n\n\n \n# if they didn't fail completely add it to the global flags\n\n ::CliGen::GLOBAL_FLAGS << \n%flg\n\n \n"}},{"html_id":"override_help_template(filepath)-macro","name":"override_help_template","abstract":false,"args":[{"name":"filepath","external_name":"filepath","restriction":""}],"args_string":"(filepath)","args_html":"(filepath)","location":{"filename":"src/cligen.cr","line_number":52,"url":null},"def":{"name":"override_help_template","args":[{"name":"filepath","external_name":"filepath","restriction":""}],"visibility":"Public","body":" \n{% unless file_exists?(filepath)\n raise(\"ERROR : CliGen.override_help_template : File(#{filepath}) doesn't exist\")\nend %}\n\n CliGen::HELP_OVERRIDE_TEMPLATE = \n{{ (`readlink -f #{filepath}`).strip.stringify }}\n\n \n"}}],"types":[{"html_id":"CliGenerator/CliGen/App","path":"CliGen/App.html","kind":"class","full_name":"CliGen::App","name":"App","abstract":false,"superclass":{"html_id":"CliGenerator/CliGen/CommandNode","kind":"class","full_name":"CliGen::CommandNode","name":"CommandNode"},"ancestors":[{"html_id":"CliGenerator/CliGen/CommandNode","kind":"class","full_name":"CliGen::CommandNode","name":"CommandNode"},{"html_id":"CliGenerator/CliGen/BaseCommandNode","kind":"class","full_name":"CliGen::BaseCommandNode","name":"BaseCommandNode"},{"html_id":"CliGenerator/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"CliGenerator/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cligen/app.cr","line_number":12,"url":null},{"filename":"src/cligen/app/generate.cr","line_number":5,"url":null}],"repository_name":"CliGenerator","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"CliGenerator/CliGen","kind":"module","full_name":"CliGen","name":"CliGen"},"doc":"Root entry point. Holds a flattened copy of all flags from every command\nfor global-flag matching, then hands off to the matched child CommandNode.","summary":"Root entry point.
","class_methods":[{"html_id":"get-class-method","name":"get","abstract":false,"location":{"filename":"src/cligen/app.cr","line_number":71,"url":null},"def":{"name":"get","visibility":"Public","body":"if @@instance.nil?\n generate\nend\n@@instance.not_nil!\n"},"external_var":false},{"html_id":"handle_command_raises(&):Nil-class-method","name":"handle_command_raises","abstract":false,"location":{"filename":"src/cligen/app.cr","line_number":51,"url":null},"def":{"name":"handle_command_raises","yields":0,"block_arity":0,"return_type":"Nil","visibility":"Public","body":"begin\n yield\nrescue e : CliGen::RuntimeError\n Fiber.yield\n abort(e.message)\nrescue e : CliGen::ConfigurationError\n Fiber.yield\n abort(e.message)\nrescue e : CliGen::HelpRequestedError\n Fiber.yield\n puts(e.message)\n exit(0)\nend"},"external_var":false},{"html_id":"process(args:Array(String)=ARGV.to_a):Nil-class-method","name":"process","doc":"Convenience entry point; defaults to ARGV","summary":"Convenience entry point; defaults to ARGV
","abstract":false,"args":[{"name":"args","default_value":"ARGV.to_a","external_name":"args","restriction":"Array(String)"}],"args_string":"(args : Array(String) = ARGV.to_a) : Nil","args_html":"(args : Array(String) = ARGV.to_a) : Nil","location":{"filename":"src/cligen/app.cr","line_number":77,"url":null},"def":{"name":"process","args":[{"name":"args","default_value":"ARGV.to_a","external_name":"args","restriction":"Array(String)"}],"return_type":"Nil","visibility":"Public","body":"handle_command_raises do\n get.not_nil!.process(args)\nend"},"external_var":false}],"constructors":[{"html_id":"new(name,flags:Array(BaseFlag),commands:Array(BaseCommandNode),pre_run_commands:Array(RunCommand),post_run_commands:Array(RunCommand))-class-method","name":"new","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""},{"name":"flags","external_name":"flags","restriction":"Array(BaseFlag)"},{"name":"commands","external_name":"commands","restriction":"Array(BaseCommandNode)"},{"name":"pre_run_commands","external_name":"pre_run_commands","restriction":"Array(RunCommand)"},{"name":"post_run_commands","external_name":"post_run_commands","restriction":"Array(RunCommand)"}],"args_string":"(name, flags : Array(BaseFlag), commands : Array(BaseCommandNode), pre_run_commands : Array(RunCommand), post_run_commands : Array(RunCommand))","args_html":"(name, flags : Array(BaseFlag), commands : Array(BaseCommandNode), pre_run_commands : Array(RunCommand), post_run_commands : Array(RunCommand))","location":{"filename":"src/cligen/app.cr","line_number":15,"url":null},"def":{"name":"new","args":[{"name":"name","external_name":"name","restriction":""},{"name":"flags","external_name":"flags","restriction":"Array(BaseFlag)"},{"name":"commands","external_name":"commands","restriction":"Array(BaseCommandNode)"},{"name":"pre_run_commands","external_name":"pre_run_commands","restriction":"Array(RunCommand)"},{"name":"post_run_commands","external_name":"post_run_commands","restriction":"Array(RunCommand)"}],"visibility":"Public","body":"_ = allocate\n_.initialize(name, flags, commands, pre_run_commands, post_run_commands)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"},"external_var":false}],"instance_methods":[{"html_id":"check!-instance-method","name":"check!","abstract":false,"location":{"filename":"src/cligen/app.cr","line_number":20,"url":null},"def":{"name":"check!","visibility":"Public","body":"super()\ncheck_for_env_duplicates(all_flags.uniq + CliGen::GLOBAL_FLAGS)\n"},"external_var":false},{"html_id":"check_for_env_duplicates(flags:Array(BaseFlag))-instance-method","name":"check_for_env_duplicates","abstract":false,"args":[{"name":"flags","external_name":"flags","restriction":"Array(BaseFlag)"}],"args_string":"(flags : Array(BaseFlag))","args_html":"(flags : Array(BaseFlag))","location":{"filename":"src/cligen/app.cr","line_number":25,"url":null},"def":{"name":"check_for_env_duplicates","args":[{"name":"flags","external_name":"flags","restriction":"Array(BaseFlag)"}],"visibility":"Public","body":"flgs = flags.reject() do |__arg0| __arg0.env_var.nil? end\n\nenv_vars = flgs.group_by() do |__arg1| __arg1.env_var.not_nil! end\n\nfailures = [] of Tuple(String, Array(BaseFlag))\n\nenv_vars.each do |env_var, flg_group|\n if flg_group.size > 1\n failures << (Tuple.new(env_var, flg_group))\n end\nend\n\nif failures.empty?\nelse\n error_buffer = \"ERROR : App(%s)#check! : Found ENV VAR Duplicates \\n%s\"\n format = \"\\n%s:\\n%s\\n\\n\"\n buffer = \"\"\n\n failures.each do |env_var, flgs|\n buffer = buffer + (format % [env_var, flgs.map do |f| \"- #{f.long_key}\" end.join(\"\\n\")])\n end\n\n raise(CliGen::DuplicateFlagError.new(error_buffer % [@name, buffer]))\nend\n"},"external_var":false}]},{"html_id":"CliGenerator/CliGen/Arg","path":"CliGen/Arg.html","kind":"class","full_name":"CliGen::Arg","name":"Arg","abstract":false,"superclass":{"html_id":"CliGenerator/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"CliGenerator/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"CliGenerator/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cligen/arg.cr","line_number":18,"url":null}],"repository_name":"CliGenerator","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"CliGenerator/CliGen","kind":"module","full_name":"CliGen","name":"CliGen"},"doc":"This class serves as a \"argument wrapper\" to force a fail-fast approach to\narg-parsing. \n\nIt wraps around the argument + index of the argument to do state tracking\nand ensure that each argument is only processed once (plus allows for\neasier filtering of processed arguments to avoid having to do index math)\n\n args.reject(&.processed?) # returns the args that haven't been processed yet\n\nIt expects each argument to only be processed once and will force a raise\nif the argument has Arg#processed called a second time. This is to force \nthe developer (me) to fix any processing issues during the development of\nthis framework.","summary":"This class serves as a "argument wrapper" to force a fail-fast approach to arg-parsing.
","class_methods":[{"html_id":"flag?(val:String):Bool-class-method","name":"flag?","abstract":false,"args":[{"name":"val","external_name":"val","restriction":"String"}],"args_string":"(val : String) : Bool","args_html":"(val : String) : Bool","location":{"filename":"src/cligen/arg.cr","line_number":30,"url":null},"def":{"name":"flag?","args":[{"name":"val","external_name":"val","restriction":"String"}],"return_type":"Bool","visibility":"Public","body":"if val =~ CliGen::Regex::FLAG_REGEX\n true\nelse\n false\nend"},"external_var":false},{"html_id":"float?(val:String):Bool-class-method","name":"float?","abstract":false,"args":[{"name":"val","external_name":"val","restriction":"String"}],"args_string":"(val : String) : Bool","args_html":"(val : String) : Bool","location":{"filename":"src/cligen/arg.cr","line_number":66,"url":null},"def":{"name":"float?","args":[{"name":"val","external_name":"val","restriction":"String"}],"return_type":"Bool","visibility":"Public","body":"if val =~ CliGen::Regex::FLOAT\n true\nelse\n false\nend"},"external_var":false},{"html_id":"int?(val:String):Bool-class-method","name":"int?","abstract":false,"args":[{"name":"val","external_name":"val","restriction":"String"}],"args_string":"(val : String) : Bool","args_html":"(val : String) : Bool","location":{"filename":"src/cligen/arg.cr","line_number":42,"url":null},"def":{"name":"int?","args":[{"name":"val","external_name":"val","restriction":"String"}],"return_type":"Bool","visibility":"Public","body":"if val =~ CliGen::Regex::INT\n true\nelse\n false\nend"},"external_var":false},{"html_id":"uint?(val:String):Bool-class-method","name":"uint?","abstract":false,"args":[{"name":"val","external_name":"val","restriction":"String"}],"args_string":"(val : String) : Bool","args_html":"(val : String) : Bool","location":{"filename":"src/cligen/arg.cr","line_number":54,"url":null},"def":{"name":"uint?","args":[{"name":"val","external_name":"val","restriction":"String"}],"return_type":"Bool","visibility":"Public","body":"if val =~ CliGen::Regex::UINT\n true\nelse\n false\nend"},"external_var":false}],"constructors":[{"html_id":"new(value:String,index:Int32)-class-method","name":"new","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"::String"},{"name":"index","external_name":"index","restriction":"::Int32"}],"args_string":"(value : String, index : Int32)","args_html":"(value : String, index : Int32)","location":{"filename":"src/cligen/arg.cr","line_number":27,"url":null},"def":{"name":"new","args":[{"name":"value","external_name":"value","restriction":"::String"},{"name":"index","external_name":"index","restriction":"::Int32"}],"visibility":"Public","body":"_ = allocate\n_.initialize(value, index)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"},"external_var":false}],"instance_methods":[{"html_id":"flag?(val:String=@value):Bool-instance-method","name":"flag?","abstract":false,"args":[{"name":"val","default_value":"@value","external_name":"val","restriction":"String"}],"args_string":"(val : String = @value) : Bool","args_html":"(val : String = @value) : Bool","location":{"filename":"src/cligen/arg.cr","line_number":38,"url":null},"def":{"name":"flag?","args":[{"name":"val","default_value":"@value","external_name":"val","restriction":"String"}],"return_type":"Bool","visibility":"Public","body":"Arg.flag?(val)"},"external_var":false},{"html_id":"float?(val:String=@value):Bool-instance-method","name":"float?","abstract":false,"args":[{"name":"val","default_value":"@value","external_name":"val","restriction":"String"}],"args_string":"(val : String = @value) : Bool","args_html":"(val : String = @value) : Bool","location":{"filename":"src/cligen/arg.cr","line_number":74,"url":null},"def":{"name":"float?","args":[{"name":"val","default_value":"@value","external_name":"val","restriction":"String"}],"return_type":"Bool","visibility":"Public","body":"Arg.float?(val)"},"external_var":false},{"html_id":"index:Int32-instance-method","name":"index","doc":"The index of the argument in the array it was in","summary":"The index of the argument in the array it was in
","abstract":false,"location":{"filename":"src/cligen/arg.cr","line_number":23,"url":null},"def":{"name":"index","return_type":"Int32","visibility":"Public","body":"@index"},"external_var":false},{"html_id":"int?(val:String=@value):Bool-instance-method","name":"int?","abstract":false,"args":[{"name":"val","default_value":"@value","external_name":"val","restriction":"String"}],"args_string":"(val : String = @value) : Bool","args_html":"(val : String = @value) : Bool","location":{"filename":"src/cligen/arg.cr","line_number":50,"url":null},"def":{"name":"int?","args":[{"name":"val","default_value":"@value","external_name":"val","restriction":"String"}],"return_type":"Bool","visibility":"Public","body":"Arg.int?(val)"},"external_var":false},{"html_id":"processed-instance-method","name":"processed","doc":"This serves as a trigger that tells the object that it has been processed\n\nThis will raise an exception if it is re-called after already having been\nprocessed.","summary":"This serves as a trigger that tells the object that it has been processed
","abstract":false,"location":{"filename":"src/cligen/arg.cr","line_number":82,"url":null},"def":{"name":"processed","visibility":"Public","body":"if @processed\n raise(CliGen::ArgReprocessedError.new(\"CliGen::Arg(index: #{@index}, value: #{@value})#processed : This arg was re-processed\"))\nend\n@processed = true\n"},"external_var":false},{"html_id":"processed?:Bool-instance-method","name":"processed?","doc":"The \"flag\"/variable that tracks is the Arg has been processed yet","summary":"The "flag"/variable that tracks is the Arg has been processed yet
","abstract":false,"location":{"filename":"src/cligen/arg.cr","line_number":25,"url":null},"def":{"name":"processed?","return_type":"Bool","visibility":"Public","body":"@processed"},"external_var":false},{"html_id":"uint?(val:String=@value):Bool-instance-method","name":"uint?","abstract":false,"args":[{"name":"val","default_value":"@value","external_name":"val","restriction":"String"}],"args_string":"(val : String = @value) : Bool","args_html":"(val : String = @value) : Bool","location":{"filename":"src/cligen/arg.cr","line_number":62,"url":null},"def":{"name":"uint?","args":[{"name":"val","default_value":"@value","external_name":"val","restriction":"String"}],"return_type":"Bool","visibility":"Public","body":"Arg.uint?(val)"},"external_var":false},{"html_id":"value:String-instance-method","name":"value","doc":"The raw string argument provided from the user","summary":"The raw string argument provided from the user
","abstract":false,"location":{"filename":"src/cligen/arg.cr","line_number":21,"url":null},"def":{"name":"value","return_type":"String","visibility":"Public","body":"@value"},"external_var":false}]},{"html_id":"CliGenerator/CliGen/ArgReprocessedError","path":"CliGen/ArgReprocessedError.html","kind":"class","full_name":"CliGen::ArgReprocessedError","name":"ArgReprocessedError","abstract":false,"superclass":{"html_id":"CliGenerator/CliGen/InternalError","kind":"class","full_name":"CliGen::InternalError","name":"InternalError"},"ancestors":[{"html_id":"CliGenerator/CliGen/InternalError","kind":"class","full_name":"CliGen::InternalError","name":"InternalError"},{"html_id":"CliGenerator/CliGen/Error","kind":"class","full_name":"CliGen::Error","name":"Error"},{"html_id":"CliGenerator/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"CliGenerator/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"CliGenerator/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cligen/exceptions.cr","line_number":15,"url":null}],"repository_name":"CliGenerator","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"CliGenerator/CliGen","kind":"module","full_name":"CliGen","name":"CliGen"},"doc":"Arg#processed was called a second time on the same Arg","summary":"Arg#processed was called a second time on the same Arg
"},{"html_id":"CliGenerator/CliGen/Argument","path":"CliGen/Argument.html","kind":"annotation","full_name":"CliGen::Argument","name":"Argument","abstract":false,"locations":[{"filename":"src/cligen/annotations.cr","line_number":205,"url":null}],"repository_name":"CliGenerator","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"CliGenerator/CliGen","kind":"module","full_name":"CliGen","name":"CliGen"},"doc":"This is used for annotating instance variables for the CliGen framework can know how to create your `CliGen::Flag(T)` objects\n\nWHILE this is usually being handled by the `CliGen::Command.argument` macro\ninside of the class body.\n\nEX:\n\n class MyCmd < CliGen::Command\n argument(myvar : String = \"test\",\n short: \"-m\",\n long: \"--myvar\",\n description: \"This is my test flag\",\n options: %w[ test test2 test3 ]\n )\n\n def main \n puts \"@myvar was #{@myvar}\"\n end\n end\n\n\nHowever, this can also be done manually if you don't want to use the macros\nyou will make me sad, but otherwise it's understandable if you want do it\nmanually. Just understand that the macros are there for doing all of the\nvalidations for user-friendly implementation.\n\n## Expected Metadata:\n\n### short:\nType: StringLiteral\n\nRequired: false\n\nThis represents the short form of the flag bring provided. it is optional as \nnot all flags have to have a short form flag. \n\n\n### long:\nType: StringLiteral\n\nRequired: true\n\nThis represents the long-form of the flag. It is required in order to generate\nthe `Flag(T)`.\n\n\n### description:\nType: StringLiteral\nRequired: true\n\nThis is the description of your flag and is required for `Flag(T)` creation\n\n\n### delimiter: \nType: StringLiteral\n\nRequired: false\n\nFor `Flag`(Array(T)) flags this is the delimiter that will seperate any inline \nargs (ex: \",\" will split \"a,b,c\") provided at the commandline. If nil/not \nprovided, the framework will default to ',' as this is the usual choice.\n\n\n### env_var:\nType: StringLiteral\n\nRequired: false\n\nThis is the ENV VAR that can be used to specify your flag value when not \nprovided by the user.\n\n\n### validation:\nType: ProcLiteral\n\nRequired: false\n\nThis is a proc that can be used to provide an ad-hoc way of verifying the\nvalue provided by a user.\n\n EX: Int Validator\n\n\n validation: ->(i : Int32) : Bool do\n (1..23).includes?(i)\n end\n\n\n This is used as a fallback to where the options: key doesn't cleanly \n provide enough of a check for the provided values.\n\n Note: \n The input value MUST be the same as the value type as the instance \n variable. Otherwise CliGen will not compile. IF requested I can \n add a raw_validation: key as well to do the same but for just the\n String variable provided by the user.\n\n### on_match:\nType: ProcLiteral\n\nRequired: false\n\nMuch like validation, this is used as a hook for doing arbitrary actions\nwith the parsed value from the user (very useful for global flags).\n\nEX: Log level setter\n\n on_match: ->(arg : String) do\n begin\n ::Log.setup(level: ::Log::Severity.parse(arg))\n rescue e : ArgumentError\n STDERR.puts \"ERROR : Failed to set to #{arg} log level: (#{e.class}: #{e.message})\"\n end\n end\n\nIn this way you can use on_match: to hook a global flag and have it call some\narbitrary method elsewhere in the codebase to help setup the environment \nbefore the main command is run.\n\n### options:\nType: ArrayLiteral(T)|Call\n\nRequired: false\n\nCURRENTLY this is being as a way of providing a static set of values that we \nare to use when doing a provided argument. \n\nEX: Options for string var\n \n options: %w[ a b c ]\n\n\nHowver, this currently also \nsupports delegating the retrieval of values (in array format) to be learned\nat runtime by providing a call to a global methods/class method/util \nmethod/etc\n\nEX: Deletgating to runtime\n \n\n module MyModule\n def self.my_method : Array(String)\n if File.exists?(\"/etc/valid_things.txt\")\n File.read(\"/etc/valid_things.txt\").split(\",\")\n else\n %w[ a b c ]\n end\n end\n\n CliGen.add_global_flag(String, \n short: \"-t\",\n long: \"--test\",\n description: \"This does things. I promise\",\n options: ::MyModule.my_method,\n on_match: ->(t : String) do \n puts \"Matched #{t}\"\n end\n )\n end\n\n\nDoing things this way gives you some runtime flexibility, but makes you \nresponsible for ensuring that it doesn't crash or provide incorrect data\nat runtime. As (unfortunately) the framework doesn't account for developer\nerror at runtime like it can at compile-time with a static array of\nvalues.\n\n\n### format: \nType: RegexLiteral\n\nRequired: false\n\nThis metadata is used to provide (mostly for strings when you don't have a\nstatically known list of values that can be provided at runtime, but you \nwant to filter out invalid options.\n\nEX: filtering for csv formatted info\n\n format: /^([a-z0-9]+)(,?[a-z0-9]+)+$/\n\n","summary":"This is used for annotating instance variables for the CliGen framework can know how to create your CliGen::Flag(T) objects
Non-generic base that lets the tree hold heterogeneous CommandNode(T) children.
","constructors":[{"html_id":"new(name:String,flags:Array(BaseFlag),commands:Array(BaseCommandNode),pre_run_commands:Array(RunCommand),post_run_commands:Array(RunCommand),meta:CommandMeta,parent:BaseCommandNode|Nil=nil,description:String|Nil=nil)-class-method","name":"new","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"String"},{"name":"flags","external_name":"flags","restriction":"Array(BaseFlag)"},{"name":"commands","external_name":"commands","restriction":"Array(BaseCommandNode)"},{"name":"pre_run_commands","external_name":"pre_run_commands","restriction":"Array(RunCommand)"},{"name":"post_run_commands","external_name":"post_run_commands","restriction":"Array(RunCommand)"},{"name":"meta","external_name":"meta","restriction":"CommandMeta"},{"name":"parent","default_value":"nil","external_name":"parent","restriction":"BaseCommandNode | ::Nil"},{"name":"description","default_value":"nil","external_name":"description","restriction":"String | ::Nil"}],"args_string":"(name : String, flags : Array(BaseFlag), commands : Array(BaseCommandNode), pre_run_commands : Array(RunCommand), post_run_commands : Array(RunCommand), meta : CommandMeta, parent : BaseCommandNode | Nil = nil, description : String | Nil = nil)","args_html":"(name : String, flags : Array(BaseFlag), commands : Array(BaseCommandNode), pre_run_commands : Array(RunCommand), post_run_commands : Array(RunCommand), meta : CommandMeta, parent : BaseCommandNode | Nil = nil, description : String | Nil = nil)","location":{"filename":"src/cligen/command_node/base.cr","line_number":25,"url":null},"def":{"name":"new","args":[{"name":"name","external_name":"name","restriction":"String"},{"name":"flags","external_name":"flags","restriction":"Array(BaseFlag)"},{"name":"commands","external_name":"commands","restriction":"Array(BaseCommandNode)"},{"name":"pre_run_commands","external_name":"pre_run_commands","restriction":"Array(RunCommand)"},{"name":"post_run_commands","external_name":"post_run_commands","restriction":"Array(RunCommand)"},{"name":"meta","external_name":"meta","restriction":"CommandMeta"},{"name":"parent","default_value":"nil","external_name":"parent","restriction":"BaseCommandNode | ::Nil"},{"name":"description","default_value":"nil","external_name":"description","restriction":"String | ::Nil"}],"visibility":"Public","body":"_ = allocate\n_.initialize(name, flags, commands, pre_run_commands, post_run_commands, meta, parent, description)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"},"external_var":false}],"instance_methods":[{"html_id":"all_commands:Array(BaseCommandNode)-instance-method","name":"all_commands","abstract":false,"location":{"filename":"src/cligen/command_node/base.cr","line_number":41,"url":null},"def":{"name":"all_commands","return_type":"Array(BaseCommandNode)","visibility":"Public","body":"@commands + @commands.flat_map(&.all_commands)"},"external_var":false},{"html_id":"all_flags:Array(BaseFlag)-instance-method","name":"all_flags","abstract":false,"location":{"filename":"src/cligen/command_node/base.cr","line_number":37,"url":null},"def":{"name":"all_flags","return_type":"Array(BaseFlag)","visibility":"Public","body":"@flags + @commands.flat_map(&.all_flags)"},"external_var":false},{"html_id":"check!:Nil-instance-method","name":"check!","abstract":true,"location":{"filename":"src/cligen/command_node/base.cr","line_number":184,"url":null},"def":{"name":"check!","return_type":"Nil","visibility":"Public","body":""},"external_var":false},{"html_id":"check_for_duplicate_flags!(flags:Array(BaseFlag)):Nil-instance-method","name":"check_for_duplicate_flags!","abstract":false,"args":[{"name":"flags","external_name":"flags","restriction":"Array(BaseFlag)"}],"args_string":"(flags : Array(BaseFlag)) : Nil","args_html":"(flags : Array(BaseFlag)) : Nil","location":{"filename":"src/cligen/command_node/base.cr","line_number":67,"url":null},"def":{"name":"check_for_duplicate_flags!","args":[{"name":"flags","external_name":"flags","restriction":"Array(BaseFlag)"}],"return_type":"Nil","visibility":"Public","body":"Log.trace do \"CommandNode(#{@name})#check_for_duplicate_flags! : entered with #{flags.map(&.long_key)}\" end\nshorts = flags.compact_map(&.short)\nshort_duplicates = [] of String\nlongs = flags.compact_map do |f| if f.long_key.empty?\nelse\n f.long_key\nend end\nlong_duplicates = [] of String\n\nlast_short : String = \"\"\nshorts.sort.each do |short|\n if last_short == short\n short_duplicates << short\n end\n last_short = short\nend\n\nlast_long : String = \"\"\nlongs.sort.each do |long|\n if last_long == long\n long_duplicates << long\n end\n last_long = long\nend\n\nif long_duplicates.empty? && short_duplicates.empty?\nelse\n error_buffer = \"ERROR : CommandNode(%s)#check! : Found Duplicates : %s\"\n\n message = \"\"\n if long_duplicates.empty?\n else\n message = message + (\"\\nLong:\\n%s\\n\" % (long_duplicates.map do |f| \"- #{f}\" end.join(\"\\n\")))\n end\n\n if short_duplicates.empty?\n else\n message = message + (\"\\nShort:\\n%s\" % (short_duplicates.map do |f| \"- #{f}\" end.join(\"\\n\")))\n end\n\n raise(CliGen::DuplicateFlagError.new(error_buffer % [@name, message]))\nend\n"},"external_var":false},{"html_id":"check_for_duplicate_subcommands!-instance-method","name":"check_for_duplicate_subcommands!","abstract":false,"location":{"filename":"src/cligen/command_node/base.cr","line_number":45,"url":null},"def":{"name":"check_for_duplicate_subcommands!","visibility":"Public","body":"failures = [] of Tuple(String, Array(BaseCommandNode))\n\n@commands.group_by(&.name).each do |command, cmd_group|\n if cmd_group.size > 1\n failures << (Tuple.new(command, cmd_group))\n end\nend\n\nif failures.empty?\nelse\n error_buffer = \"ERROR : #{self.class}(%s)#check! : Found Command Name Duplicates \\n%s\"\n format = \"\\n%s:\\n%s\\n\\n\"\n buffer = \"\"\n\n failures.each do |name, cmds|\n buffer = buffer + (format % [name, cmds.map do |c| \"- #{c.meta.cls} (#{c.description})\" end.join(\"\\n\")])\n end\n\n raise(CliGen::DuplicateCommandError.new(error_buffer % [@name, buffer]))\nend\n"},"external_var":false},{"html_id":"commands:Array(BaseCommandNode)-instance-method","name":"commands","abstract":false,"location":{"filename":"src/cligen/command_node/base.cr","line_number":16,"url":null},"def":{"name":"commands","return_type":"Array(BaseCommandNode)","visibility":"Public","body":"@commands"},"external_var":false},{"html_id":"description:String|Nil-instance-method","name":"description","abstract":false,"location":{"filename":"src/cligen/command_node/base.cr","line_number":17,"url":null},"def":{"name":"description","return_type":"String | ::Nil","visibility":"Public","body":"@description"},"external_var":false},{"html_id":"find_match(arg:String)-instance-method","name":"find_match","abstract":false,"args":[{"name":"arg","external_name":"arg","restriction":"String"}],"args_string":"(arg : String)","args_html":"(arg : String)","location":{"filename":"src/cligen/command_node/base.cr","line_number":122,"url":null},"def":{"name":"find_match","args":[{"name":"arg","external_name":"arg","restriction":"String"}],"visibility":"Public","body":"Log.trace do \"CommandNode(#{@name})#find_match(#{arg}) : Entered\" end\nif subcommand?(arg)\n Log.debug do \"CommandNode(#{@name})#find_match(#{arg}) : arg found to be subcommand\" end\n return CliGen::MatchType::SubCommand\nend\n\ncase arg\nwhen CliGen::Regex::FLAG_REGEX\n Log.debug do \"CommandNode(#{@name})#find_match(#{arg}) : arg found to match the format of a flag\" end\n if flg = flag?(arg)\n Log.debug do \"CommandNode(#{@name})#find_match(#{arg}) : arg found to be a Flag(long: #{flg.long_key})\" end\n flg\n else\n Log.debug do \"CommandNode(#{@name})#find_match(#{arg}) : arg found not to have a flag associated with it\" end\n CliGen::MatchType::NoMatch\n end\nwhen CliGen::Regex::FLAG_WITH_ARG\n Log.debug do \"CommandNode(#{@name})#find_match(#{arg}) : arg found to match the format of a flag with an argConverts String array to Arg array and hands off to the typed process method
","abstract":false,"args":[{"name":"args","external_name":"args","restriction":"Array(String)"}],"args_string":"(args : Array(String)) : Nil","args_html":"(args : Array(String)) : Nil","location":{"filename":"src/cligen/command_node/base.cr","line_number":177,"url":null},"def":{"name":"process","args":[{"name":"args","external_name":"args","restriction":"Array(String)"}],"return_type":"Nil","visibility":"Public","body":"Log.trace do \"CommandNode(#{@name})#process(#{args}) : Entered\" end\nnew_args = args.each_with_index.map do |arg, i| CliGen::Arg.new(value: arg, index: i) end.to_a\nprocess(new_args)\n"},"external_var":false},{"html_id":"process(args:Array(CliGen::Arg)):Nil-instance-method","name":"process","abstract":true,"args":[{"name":"args","external_name":"args","restriction":"Array(CliGen::Arg)"}],"args_string":"(args : Array(CliGen::Arg)) : Nil","args_html":"(args : Array(CliGen::Arg)) : Nil","location":{"filename":"src/cligen/command_node/base.cr","line_number":185,"url":null},"def":{"name":"process","args":[{"name":"args","external_name":"args","restriction":"Array(CliGen::Arg)"}],"return_type":"Nil","visibility":"Public","body":""},"external_var":false},{"html_id":"subcommand?(arg:String):Bool-instance-method","name":"subcommand?","abstract":false,"args":[{"name":"arg","external_name":"arg","restriction":"String"}],"args_string":"(arg : String) : Bool","args_html":"(arg : String) : Bool","location":{"filename":"src/cligen/command_node/base.cr","line_number":161,"url":null},"def":{"name":"subcommand?","args":[{"name":"arg","external_name":"arg","restriction":"String"}],"return_type":"Bool","visibility":"Public","body":"Log.trace do \"CommandNode(#{@name})#subcommand?(#{arg}) : Entered\" end\nsubcommands.any?() do |__arg12| __arg12.name == arg end\n"},"external_var":false},{"html_id":"subcommands:Array(SubCommandInfo)-instance-method","name":"subcommands","abstract":true,"location":{"filename":"src/cligen/command_node/base.cr","line_number":183,"url":null},"def":{"name":"subcommands","return_type":"Array(SubCommandInfo)","visibility":"Public","body":""},"external_var":false},{"html_id":"subcommands?:Bool-instance-method","name":"subcommands?","abstract":false,"location":{"filename":"src/cligen/command_node/base.cr","line_number":157,"url":null},"def":{"name":"subcommands?","return_type":"Bool","visibility":"Public","body":"subcommands.size > 0"},"external_var":false}]},{"html_id":"CliGenerator/CliGen/BaseFlag","path":"CliGen/BaseFlag.html","kind":"class","full_name":"CliGen::BaseFlag","name":"BaseFlag","abstract":true,"superclass":{"html_id":"CliGenerator/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"CliGenerator/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"CliGenerator/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cligen/flag/base.cr","line_number":9,"url":null}],"repository_name":"CliGenerator","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"Log","name":"Log","value":"::Log.for(CliGen::Flag)"}],"subclasses":[{"html_id":"CliGenerator/CliGen/Flag","kind":"class","full_name":"CliGen::Flag(T)","name":"Flag"}],"namespace":{"html_id":"CliGenerator/CliGen","kind":"module","full_name":"CliGen","name":"CliGen"},"constructors":[{"html_id":"new(var:String,short:String|Nil,long:String,env_var:String|Nil,description:String,delimiter:String,meta:FlagMeta)-class-method","name":"new","abstract":false,"args":[{"name":"var","external_name":"var","restriction":"String"},{"name":"short","external_name":"short","restriction":"String | ::Nil"},{"name":"long","external_name":"long","restriction":"String"},{"name":"env_var","external_name":"env_var","restriction":"String | ::Nil"},{"name":"description","external_name":"description","restriction":"String"},{"name":"delimiter","external_name":"delimiter","restriction":"String"},{"name":"meta","external_name":"meta","restriction":"FlagMeta"}],"args_string":"(var : String, short : String | Nil, long : String, env_var : String | Nil, description : String, delimiter : String, meta : FlagMeta)","args_html":"(var : String, short : String | Nil, long : String, env_var : String | Nil, description : String, delimiter : String, meta : FlagMeta)","location":{"filename":"src/cligen/flag/base.cr","line_number":21,"url":null},"def":{"name":"new","args":[{"name":"var","external_name":"var","restriction":"String"},{"name":"short","external_name":"short","restriction":"String | ::Nil"},{"name":"long","external_name":"long","restriction":"String"},{"name":"env_var","external_name":"env_var","restriction":"String | ::Nil"},{"name":"description","external_name":"description","restriction":"String"},{"name":"delimiter","external_name":"delimiter","restriction":"String"},{"name":"meta","external_name":"meta","restriction":"FlagMeta"}],"visibility":"Public","body":"_ = allocate\n_.initialize(var, short, long, env_var, description, delimiter, meta)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"},"external_var":false}],"instance_methods":[{"html_id":"check!:Nil-instance-method","name":"check!","abstract":true,"location":{"filename":"src/cligen/flag/base.cr","line_number":55,"url":null},"def":{"name":"check!","return_type":"Nil","visibility":"Public","body":""},"external_var":false},{"html_id":"delimiter:String-instance-method","name":"delimiter","abstract":false,"location":{"filename":"src/cligen/flag/base.cr","line_number":16,"url":null},"def":{"name":"delimiter","return_type":"String","visibility":"Public","body":"@delimiter"},"external_var":false},{"html_id":"description:String-instance-method","name":"description","abstract":false,"location":{"filename":"src/cligen/flag/base.cr","line_number":15,"url":null},"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"},"external_var":false},{"html_id":"env_var:String|Nil-instance-method","name":"env_var","abstract":false,"location":{"filename":"src/cligen/flag/base.cr","line_number":14,"url":null},"def":{"name":"env_var","return_type":"String | ::Nil","visibility":"Public","body":"@env_var"},"external_var":false},{"html_id":"long:String-instance-method","name":"long","abstract":false,"location":{"filename":"src/cligen/flag/base.cr","line_number":12,"url":null},"def":{"name":"long","return_type":"String","visibility":"Public","body":"@long"},"external_var":false},{"html_id":"long_key:String-instance-method","name":"long_key","abstract":false,"location":{"filename":"src/cligen/flag/base.cr","line_number":13,"url":null},"def":{"name":"long_key","return_type":"String","visibility":"Public","body":"@long_key"},"external_var":false},{"html_id":"matches?(token:String):Bool-instance-method","name":"matches?","abstract":false,"args":[{"name":"token","external_name":"token","restriction":"String"}],"args_string":"(token : String) : Bool","args_html":"(token : String) : Bool","location":{"filename":"src/cligen/flag/base.cr","line_number":47,"url":null},"def":{"name":"matches?","args":[{"name":"token","external_name":"token","restriction":"String"}],"return_type":"Bool","visibility":"Public","body":"Log.trace do \"Flag(#{@long})#matches?(#{token}) : entered\" end\n(token == @short) || (!@long_key.empty? && (token == @long_key))\n"},"external_var":false},{"html_id":"meta:FlagMeta-instance-method","name":"meta","abstract":false,"location":{"filename":"src/cligen/flag/base.cr","line_number":17,"url":null},"def":{"name":"meta","return_type":"FlagMeta","visibility":"Public","body":"@meta"},"external_var":false},{"html_id":"raw_value:String|Nil-instance-method","name":"raw_value","abstract":true,"location":{"filename":"src/cligen/flag/base.cr","line_number":54,"url":null},"def":{"name":"raw_value","return_type":"String | ::Nil","visibility":"Public","body":""},"external_var":false},{"html_id":"satisfied?:Bool-instance-method","name":"satisfied?","abstract":true,"location":{"filename":"src/cligen/flag/base.cr","line_number":52,"url":null},"def":{"name":"satisfied?","return_type":"Bool","visibility":"Public","body":""},"external_var":false},{"html_id":"short:String|Nil-instance-method","name":"short","abstract":false,"location":{"filename":"src/cligen/flag/base.cr","line_number":11,"url":null},"def":{"name":"short","return_type":"String | ::Nil","visibility":"Public","body":"@short"},"external_var":false},{"html_id":"validate!:Nil-instance-method","name":"validate!","abstract":true,"location":{"filename":"src/cligen/flag/base.cr","line_number":53,"url":null},"def":{"name":"validate!","return_type":"Nil","visibility":"Public","body":""},"external_var":false},{"html_id":"var:String-instance-method","name":"var","abstract":false,"location":{"filename":"src/cligen/flag/base.cr","line_number":10,"url":null},"def":{"name":"var","return_type":"String","visibility":"Public","body":"@var"},"external_var":false}]},{"html_id":"CliGenerator/CliGen/Coercable","path":"CliGen/Coercable.html","kind":"module","full_name":"CliGen::Coercable","name":"Coercable","abstract":false,"locations":[{"filename":"src/cligen/coercable.cr","line_number":4,"url":null}],"repository_name":"CliGenerator","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"CliGenerator/CliGen","kind":"module","full_name":"CliGen","name":"CliGen"},"instance_methods":[{"html_id":"coerce(arg:String)-instance-method","name":"coerce","abstract":true,"args":[{"name":"arg","external_name":"arg","restriction":"String"}],"args_string":"(arg : String)","args_html":"(arg : String)","location":{"filename":"src/cligen/coercable.cr","line_number":5,"url":null},"def":{"name":"coerce","args":[{"name":"arg","external_name":"arg","restriction":"String"}],"visibility":"Public","body":""},"external_var":false}]},{"html_id":"CliGenerator/CliGen/Command","path":"CliGen/Command.html","kind":"class","full_name":"CliGen::Command","name":"Command","abstract":false,"superclass":{"html_id":"CliGenerator/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"CliGenerator/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"CliGenerator/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cligen/command.cr","line_number":19,"url":null},{"filename":"src/cligen/command/argument.cr","line_number":5,"url":null},{"filename":"src/cligen/command/define_command_initializer.cr","line_number":5,"url":null},{"filename":"src/cligen/command/define_singleton_init.cr","line_number":5,"url":null},{"filename":"src/cligen/command/generate_gather_handler.cr","line_number":2,"url":null},{"filename":"src/cligen/command/generate_register_command.cr","line_number":3,"url":null},{"filename":"src/cligen/command/help_template.cr","line_number":5,"url":null},{"filename":"src/cligen/command/resolve_value.cr","line_number":2,"url":null},{"filename":"src/cligen/command/subcommand.cr","line_number":5,"url":null},{"filename":"src/cligen/command/validate_command_tree.cr","line_number":2,"url":null}],"repository_name":"CliGenerator","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"CliGenerator/CliGen","kind":"module","full_name":"CliGen","name":"CliGen"},"instance_methods":[{"html_id":"handler?:Bool-instance-method","name":"handler?","abstract":false,"location":{"filename":"src/cligen/command.cr","line_number":23,"url":null},"def":{"name":"handler?","return_type":"Bool","visibility":"Public","body":"!@handler.nil?"},"external_var":false}],"macros":[{"html_id":"argument(variable,description,long=nil,short=nil,validation=nil,on_match=nil,def_setter=false,def_getter=false,options=nil,delimiter=\",\",format=nil,allow_no_verification=false,env_var=\"\")-macro","name":"argument","abstract":false,"args":[{"name":"variable","external_name":"variable","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"long","default_value":"nil","external_name":"long","restriction":""},{"name":"short","default_value":"nil","external_name":"short","restriction":""},{"name":"validation","default_value":"nil","external_name":"validation","restriction":""},{"name":"on_match","default_value":"nil","external_name":"on_match","restriction":""},{"name":"def_setter","default_value":"false","external_name":"def_setter","restriction":""},{"name":"def_getter","default_value":"false","external_name":"def_getter","restriction":""},{"name":"options","default_value":"nil","external_name":"options","restriction":""},{"name":"delimiter","default_value":"\",\"","external_name":"delimiter","restriction":""},{"name":"format","default_value":"nil","external_name":"format","restriction":""},{"name":"allow_no_verification","default_value":"false","external_name":"allow_no_verification","restriction":""},{"name":"env_var","default_value":"\"\"","external_name":"env_var","restriction":""}],"args_string":"(variable, description, long = nil, short = nil, validation = nil, on_match = nil, def_setter = false, def_getter = false, options = nil, delimiter = \",\", format = nil, allow_no_verification = false, env_var = \"\")","args_html":"(variable, description, long = nil, short = nil, validation = nil, on_match = nil, def_setter = false, def_getter = false, options = nil, delimiter = ",", format = nil, allow_no_verification = false, env_var = "")","location":{"filename":"src/cligen/command/argument.cr","line_number":6,"url":null},"def":{"name":"argument","args":[{"name":"variable","external_name":"variable","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"long","default_value":"nil","external_name":"long","restriction":""},{"name":"short","default_value":"nil","external_name":"short","restriction":""},{"name":"validation","default_value":"nil","external_name":"validation","restriction":""},{"name":"on_match","default_value":"nil","external_name":"on_match","restriction":""},{"name":"def_setter","default_value":"false","external_name":"def_setter","restriction":""},{"name":"def_getter","default_value":"false","external_name":"def_getter","restriction":""},{"name":"options","default_value":"nil","external_name":"options","restriction":""},{"name":"delimiter","default_value":"\",\"","external_name":"delimiter","restriction":""},{"name":"format","default_value":"nil","external_name":"format","restriction":""},{"name":"allow_no_verification","default_value":"false","external_name":"allow_no_verification","restriction":""},{"name":"env_var","default_value":"\"\"","external_name":"env_var","restriction":""}],"visibility":"Public","body":" \n{% unless def_setter.is_a?(BoolLiteral)\n raise(\"ERROR : CliGen::Command.argument : def_setter must be a Bool\")\nend %}\n\n \n{% unless def_getter.is_a?(BoolLiteral)\n raise(\"ERROR : CliGen::Command.argument : def_getter must be a Bool\")\nend %}\n\n \n{% unless variable.is_a?(TypeDeclaration)\n raise(\"ERROR : CliGen::Command.argument : First argument (#{variable}) must be a TypeDeclaration (ex: ' :This macro simply provides a easy singleton initializer for your command to allow for you do (if this class isn't the target of a command) to still be able to gather a Command object without having to have it as the target.
","abstract":false,"location":{"filename":"src/cligen/command/define_singleton_init.cr","line_number":15,"url":null},"def":{"name":"define_singleton_init","visibility":"Public","body":" def initialize\n \n{% verbatim do %}\n gather_handler unless @handler\n {% for var in @type.instance_vars %}\n {% if var.default_value.nil? && !var.type.nilable?\n raise(\"ERROR : Can't define a default initializer if #{var.name} doesn't have a default\")\n end %}\n {% if anno = var.annotation(CliGen::Argument) %}\n {% if var.default_value.nil?\n raise(\"ERROR : #{@type}#initialize : Can't define a default initializer for a cligen managed ivar if #{var.name} doesn't have a default\")\n end %}\n # If the variable is cligen managed we can define the value from the handler and resolve the setting from\n @{{ var.name }} = @handler.flags.find{|flg| flg.var == {{ var.name.stringify }} && flg.long == {{ anno[:long] }}}.not_nil!.as(Flag({{ var.type }})).value!\n {% else %}\n {% if var.default_value.nil? && !var.type.nilable?\n raise(\"ERROR : #{@type}#initialize : Can't define a default initializer if #{var.name} doesn't have a default\")\n end %}\n @{{ var.name }} = {{ var.default_value }}\n {% end %}\n {% end %}\n {% end %}\n\n \nend\n\n def after_initialize\n @@instance = self\n \nend\n\n def self.get \n @@instance ||= new\n \nend\n \n"}},{"html_id":"generate_gather_handler-macro","name":"generate_gather_handler","abstract":false,"location":{"filename":"src/cligen/command/generate_gather_handler.cr","line_number":3,"url":null},"def":{"name":"generate_gather_handler","visibility":"Public","body":" def gather_handler\n unless @handler\n unless @handler = CliGen::App.get.all_commands.find(&.meta.cls.== \n{{ @type.name.stringify }}\n)\n raise CliGen::ConfigurationError.new(\"ERROR : #{self.class}#gather_handler : Was unable to find handler for this instance\")\n \nend\n \nend\n \nend\n \n"}},{"html_id":"generate_register_command-macro","name":"generate_register_command","abstract":false,"location":{"filename":"src/cligen/command/generate_register_command.cr","line_number":4,"url":null},"def":{"name":"generate_register_command","visibility":"Public","body":" \n{% verbatim do %}\n def self.register_command(command_array : Array(CliGen::BaseCommandNode), parent : CliGen::BaseCommandNode? = nil)\n cmd_flags = [] of CliGen::BaseFlag\n cmd_subcommands = [] of CliGen::BaseCommandNode\n cmd_pre_run_cmds = [] of Proc(Nil)\n cmd_post_run_cmds = [] of Proc(Nil)\n\n\n {% for var in @type.instance_vars.select(&.annotation(CliGen::Argument)) %}\n {% anno = var.annotation(CliGen::Argument) %}\n CliGen::Common.check_flag_vars(\n raise_base: {{ \"CliGen::Command(#{@type.name}).generate_register_command\" }},\n type: {{ var.type }},\n long: {{ anno[:long] }},\n env_var: {{ anno[:env_var] }},\n short: {{ anno[:short] }},\n validation: {{ anno[:validation] }},\n on_match: {{ anno[:on_match] }},\n options: {{ anno[:options] }},\n description: {{ anno[:description] }},\n allow_no_verification: {{ anno[:allow_no_verification] }},\n format: {{ anno[:format] }},\n delimiter: {{ anno[:delimiter] }}\n )\n\n cmd_flags << CliGen::Flag({{ var.type }}).new(\n var: {{ var.name.stringify }},\n short: {% if anno[:short] %} {{ anno[:short] }} {% else %} nil {% end %},\n long: {{ anno[:long] }},\n {% if anno[:env_var] == \"\" %}\n {% if @type.name.stringify =~ (/::/) %}\n env_var: \"{{ (@type.name.upcase.split(\"::\")).last.id }}_{{ var.name.upcase }}\",\n {% else %}\n env_var: \"{{ @type.name.upcase.id }}_{{ var.name.upcase }}\",\n {% end %}\n {% else %} \n env_var: {{ anno[:env_var] }},\n {% end %}\n description: {{ anno[:description] }},\n default: {% unless var.default_value.nil? %} {{ var.default_value }} {% else %} nil {% end %},\n validate: {% if anno[:validation] %} {{ anno[:validation] }} {% else %} nil {% end %},\n on_match: {% if anno[:on_match] %} {{ anno[:on_match] }} {% else %} nil {% end %},\n options: {% if anno[:options] %} {{ anno[:options] }} {% else %} nil {% end %},\n delimiter: {% if anno[:delimiter] %} {{ anno[:delimiter] }} {% else %} \",\" {% end %},\n format: {% if anno[:format] %} {{ anno[:format] }} {% else %} nil {% end %}\n )\n {% end %}\n\n {% if true %}\n {% cmd_anno = @type.annotation(CliGen::CommandInfo) %}\n command = CliGen::CommandNode({{ @type }}).new(\n {% if @type.name.stringify =~ (/::/) %}\n name: {{ (@type.name.stringify.split(\"::\")).last.downcase }},\n {% else %}\n name: {{ @type.name.stringify.downcase }},\n {% end %}\n flags: cmd_flags,\n commands: cmd_subcommands,\n pre_run_commands: cmd_pre_run_cmds,\n post_run_commands: cmd_post_run_cmds,\n parent: parent,\n description: {{ cmd_anno[:description] }}\n )\n command_array << command\n {% end %}\n\n {% for cmd in CliGen::Command.subclasses %}\n {% cmd_anno = cmd.annotation(CliGen::CommandInfo) %}\n {% unless cmd.annotation(CliGen::CommandInfo) %}\n {% raise(\"ERROR : CliGen::Command(#{@type}).generate_register_command : #{cmd} must have an CliGen::CommandInfo annotation\") %}\n {% end %}\n {% unless cmd_anno[:parent].nil? %}\n {% if cmd_anno[:parent].resolve == @type %}\n {{ cmd }}.register_command(cmd_subcommands, parent: command)\n {% end %}\n {% end %}\n {% end %}\n end\n {% end %}\n\n \n"}},{"html_id":"help_template(filepath)-macro","name":"help_template","abstract":false,"args":[{"name":"filepath","external_name":"filepath","restriction":""}],"args_string":"(filepath)","args_html":"(filepath)","location":{"filename":"src/cligen/command/help_template.cr","line_number":6,"url":null},"def":{"name":"help_template","args":[{"name":"filepath","external_name":"filepath","restriction":""}],"visibility":"Public","body":" \n{% unless file_exists?(filepath)\n raise(\"ERROR : CliGen::Command.help_template : #{filepath} does not exist\")\nend %}\n\n HELP_TEMPLATE = \n{{ (`readlink -f #{filepath}`).strip.stringify }}\n\n \n{% if env(\"DEBUG\")\n puts(\"DEBUG : #{@type.name} : Set HELP_TEMPLATE to #{filepath}\")\nend %}\n\n \n{% if env(\"DEBUG\")\n debug\nend %}\n\n \n"}},{"html_id":"resolve_value(variable,*,default=nil)-macro","name":"resolve_value","doc":"This macro is just meant to provide the user an ability to resolve instance \nvar/varibles from parent commands. Simply to allow subcommands to be able\nto retrieve values from their parents\n\nAs an aside, this (as written) can only be used for variables that have\na default defined (ex: @var : Int32 = 3)\n\nFor variables that (in your parent class) isn't set with a default value, \nyou will need to provide the (default:This macro is just meant to provide the user an ability to resolve instance var/varibles from parent commands.
","abstract":false,"args":[{"name":"variable","external_name":"variable","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"default","default_value":"nil","external_name":"default","restriction":""}],"args_string":"(variable, *, default = nil)","args_html":"(variable, *, default = nil)","location":{"filename":"src/cligen/command/resolve_value.cr","line_number":17,"url":null},"def":{"name":"resolve_value","args":[{"name":"variable","external_name":"variable","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"default","default_value":"nil","external_name":"default","restriction":""}],"splat_index":1,"visibility":"Public","body":" \n{% variable = variable.id %}\n\n \n{% commands = [] of TypeNode %}\n\n \n{% commands << @type %}\n\n \n{% if env(\"DEBUG\")\n puts(\"DEBUG : #{@type.name}##{@def.name} : resolve_value : Entered with #{variable}\")\nend %}\n\n \n{% anno = @type.annotation(CliGen::CommandInfo) %}\n\n \n{% parent = nil %}\n\n \n{% current = nil %}\n\n \n{% var = nil %}\n\n \n# if this provided variable exists in the current clases space \n\n \n{% if v = @type.instance_vars.find() do |__arg0| __arg0.name.stringify == variable.stringify end %}\n {% if env(\"DEBUG\")\n puts(\"DEBUG : #{@type.name}##{@def.name} : resolve_value : Looks like variable is a local one\")\nend %}\n @{{ v.name }}\n # in this case we have a command tree (annotation driven) and we're going \n # to try and iterate through them to see if we can find the variable name \n # that the user is trying to meet\n {% elsif p = anno[:parent] %}\n {% if env(\"DEBUG\")\n puts(\"DEBUG : #{@type.name}##{@def.name} : resolve_value : Looks we couldn't find it in the class itself. Checking parents\")\nend %}\n {% if env(\"DEBUG\")\n puts(\"DEBUG : #{@type.name}##{@def.name} : resolve_value : Parent is defined as #{p}\")\nend %}\n {% var = nil %}\n {% current = p.resolve %}\n {% if env(\"DEBUG\")\n puts(\"DEBUG : #{@type.name}##{@def.name} : resolve_value : Beginning iteration into parent chain to find an object with that variable\")\nend %}\n {% for i in (1..CliGen::MAX_COMMAND_DEPTH) %}\n {% iteration = \"#{i}/#{CliGen::MAX_COMMAND_DEPTH}\".id %}\n {% unless current.nil? %}\n {% anno = current.annotation(CliGen::CommandInfo) %}\n {% if env(\"TRACE\")\n puts(\"TRACE : #{@type.name}##{@def.name} : resolve_value : Iteration (#{iteration}) : var = #{var}\")\nend %}\n {% if env(\"TRACE\")\n puts(\"TRACE : #{@type.name}##{@def.name} : resolve_value : Iteration (#{iteration}) : current = #{current}\")\nend %}\n {% if env(\"TRACE\")\n puts(\"TRACE : #{@type.name}##{@def.name} : resolve_value : Iteration (#{iteration}) : anno = #{anno}\")\nend %}\n {% if commands.includes?(current) %}\n {% puts(\"ERROR : #{@type}##{@def} : resolve_value : #{current.name} has already been processed. Meaning we have detected a circular reference. \") %}\n {% puts(\"Processed commands: \") %}\n {% for cmd, i in commands %}\n {% puts(\"#{i}) #{cmd.name}\") %}\n {% end %}\n {% raise(\"Circular Referfence detected. Please fix your annotations.\") %}\n {% else %}\n {% commands << current %}\n {% end %}\n {% if v = current.instance_vars.select(&.annotation(CliGen::Argument)).find() do |__arg2| __arg2.name.stringify == variable.stringify end %}\n {% if env(\"DEBUG\")\n puts(\"DEBUG : #{@type.name}##{@def.name} : resolve_value : Iteration (#{iteration}) : found variable from current parent : v = #{v}\")\nend %}\n {% var = v %}\n {% parent = current %}\n {% current = nil %}\n {% elsif p = anno[:parent] %}\n {% current = p.resolve %}\n {% else %}\n {% current = nil %}\n {% end %}\n {% end %}\n {% end %}\n {% unless current.nil? %}\n {% puts(\"ERROR : #{@type}##{@def.name} : resolve_value : It looks like your Commands tree either has a circular reference or extends past the max number of commands allowed. \") %}\n {% puts(\"CliGen::MAX_COMMAND_DEPTH: #{CliGen::MAX_COMMAND_DEPTH}\") %}\n {% puts(\"Last Recorded Command: #{current.name}\") %}\n {% puts(\"Processed Command List:\") %}\n {% for cmd, i in commands %}\n {% puts(\"#{i}: #{cmd}\") %}\n {% end %}\n {% raise(\"Please fix this or up the MAX_COMMAND_DEPTH.\") %}\n {% end %}\n {% if var.nil? %}\n {% puts(\"ERROR : #{@type}##{@def.name} : resolve_value : Was not able to find a variable in the command tree that matched #{variable}.\") %}\n {% puts(\"Valid Options are: \") %}\n {% for cmd in commands %}\n {% puts(\"Command(#{cmd.name}): \") %}\n {% for ivar in cmd.instance_vars.select(&.annotation(CliGen::Argument)) %}\n {% anno = ivar.annotation(CliGen::Argument) %}\n {% puts(\"- #{ivar.name} : #{ivar.type} = #{ivar.default_value.nil? ? \"!not set!\" : ivar.default_value} (description: \\\"#{anno[:description]}\\\")\") %}\n {% end %}\n {% puts(\"\") %}\n {% end %}\n {% end %}\n {% if var.default_value.nil? %}\n {% if default.nil? %}\n {% raise(\"ERROR : #{@type}##{@def.name} : resolve_value : #{var.name} is recorded to not have any default values. So in order to use this macro you must provide a default via the (default:) key in this macro\") %}\n {% else %}\n %default : {{ var.type }} = {{ default }}\n {% end %}\n {% end %}\n gather_handler unless @handler\n %handler : CliGen::BaseCommandNode? = @handler\n\n unless %handler\n raise \"ERROR : No handler defined for this command\"\n end\n\n %parent : CliGen::BaseCommandNode? = %handler.parent?\n\n until %parent.nil? || %parent.not_nil!.meta.cls == {{ parent.name.stringify }}\n %parent = %parent.parent?\n end\n\n if %parent.nil?\n raise \"ERROR : {{ @type }}\\#{{@def.name}} : resolve_value : Was unable to find the parent for {{ variable }}\"\n else\n if %flg = %parent.flags.find(&.var.== {{ variable.stringify }})\n {% unless default.nil? %}\n begin \n {% end %}\n %flg.as(CliGen::Flag({{ var.type }})).value!\n {% unless default.nil? %}\n rescue e : CliGen::MissingRequiredFlagError\n %default\n end\n {% end %}\n else \n raise \"ERROR : {{ @type }}\\#{{@def.name}} : resolve_value : Was unable to find the flag for {{ variable }}\"\n end\n end\n {% else %}\n {% raise(\"ERROR : #{@type}##{@def.name} : resolve_value : Wasn't able to find a source for #{variable}\") %}\n {% end %}\n\n \n"}},{"html_id":"subcommand(func,description,examples=nil,&block)-macro","name":"subcommand","abstract":false,"args":[{"name":"func","external_name":"func","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"examples","default_value":"nil","external_name":"examples","restriction":""}],"args_string":"(func, description, examples = nil, &block)","args_html":"(func, description, examples = nil, &block)","location":{"filename":"src/cligen/command/subcommand.cr","line_number":6,"url":null},"def":{"name":"subcommand","args":[{"name":"func","external_name":"func","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"examples","default_value":"nil","external_name":"examples","restriction":""}],"block_arg":{"name":"block","external_name":"block","restriction":""},"visibility":"Public","body":" \n{% unless func.is_a?(TypeDeclaration) || func.is_a?(Call)\n raise(\"ERROR : CliGen::Command.subcommand : First argument must be a TypeDeclaration, or Call (ex: ' :This macro serves as a compile-time checker of the command-tree to validate that there is no recursive references of the command-list that would possibly cause a recursive stack-overflow during App.generate when App begins registering all user defined commands.
","abstract":false,"location":{"filename":"src/cligen/command/validate_command_tree.cr","line_number":26,"url":null},"def":{"name":"validate_command_tree","visibility":"Public","body":" \n# Checking if the current type's parent is itself\n\n \n{% if p = (@type.annotation(CliGen::CommandInfo))[:parent] %}\n {% if p.resolve == @type %}\n {% raise(\"ERROR : #{@type.name} < CliGen::Command : Circular parent defined between #{@type.name} and itself\") %}\n {% end %}\n {% end %}\n\n\n \n# Checking if any other commands in the tree are circular with this one\n\n \n{% issue_topic = nil %}\n\n \n{% current = @type %}\n\n \n{% for i in (1..CliGen::MAX_COMMAND_DEPTH) %}\n {% unless current.nil? %}\n {% if parent = (current.annotation(CliGen::CommandInfo))[:parent] %}\n {% parent = parent.resolve %}\n {% if parent == @type %}\n {% issue_topic = current %}\n {% else %}\n {% current = parent %}\n {% end %}\n {% else %}\n {% current = nil %}\n {% end %}\n {% end %}\n {% end %}\n\n\n \n{% if issue_topic %}\n {% raise(\"ERROR : #{@type.name} < CliGen::Command : Circular parent defined between #{@type.name} and #{issue_topic.name}\") %}\n {% end %}\n\n\n \n{% unless current.nil? %}\n {% raise(\"ERROR : #{@type.name} < CliGen::Command : Discovered command-tree is either circular or larger than CliGen::MAX_COMMAND_DEPTH (which is set to #{CliGen::MAX_COMMAND_DEPTH}). Please address\") %}\n {% end %}\n\n \n"}}]},{"html_id":"CliGenerator/CliGen/CommandInfo","path":"CliGen/CommandInfo.html","kind":"annotation","full_name":"CliGen::CommandInfo","name":"CommandInfo","abstract":false,"locations":[{"filename":"src/cligen/annotations.cr","line_number":20,"url":null}],"repository_name":"CliGenerator","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"CliGenerator/CliGen","kind":"module","full_name":"CliGen","name":"CliGen"},"doc":"This is used to annotate a CliGen::Command subclass to define the description and other possible information in the future\n\nThe CliGen Framework uses this to store metadata for the creation of the associated CliGen::CommandNode(T) objects.\n\nKeys:\n description: StringLiteral\n This is what you use to define the short blurb of what this command is and does","summary":"This is used to annotate a CliGen::Command subclass to define the description and other possible information in the future
"},{"html_id":"CliGenerator/CliGen/CommandMeta","path":"CliGen/CommandMeta.html","kind":"struct","full_name":"CliGen::CommandMeta","name":"CommandMeta","abstract":false,"superclass":{"html_id":"CliGenerator/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"CliGenerator/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"CliGenerator/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"CliGenerator/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cligen/command_node/command_meta.cr","line_number":5,"url":null}],"repository_name":"CliGenerator","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"CliGenerator/CliGen","kind":"module","full_name":"CliGen","name":"CliGen"},"constructors":[{"html_id":"new(cls:String)-class-method","name":"new","abstract":false,"args":[{"name":"cls","external_name":"cls","restriction":"String"}],"args_string":"(cls : String)","args_html":"(cls : String)","location":{"filename":"src/cligen/command_node/command_meta.cr","line_number":5,"url":null},"def":{"name":"new","args":[{"name":"cls","external_name":"cls","restriction":"String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(cls)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"},"external_var":false}],"instance_methods":[{"html_id":"clone-instance-method","name":"clone","abstract":false,"location":{"filename":"src/cligen/command_node/command_meta.cr","line_number":5,"url":null},"def":{"name":"clone","visibility":"Public","body":"self.class.new(@cls.clone)"},"external_var":false},{"html_id":"cls:String-instance-method","name":"cls","abstract":false,"def":{"name":"cls","return_type":"String","visibility":"Public","body":"@cls"},"external_var":false},{"html_id":"copy_with(cls_cls=@cls)-instance-method","name":"copy_with","abstract":false,"args":[{"name":"_cls","default_value":"@cls","external_name":"cls","restriction":""}],"args_string":"(cls _cls = @cls)","args_html":"(cls _cls = @cls)","location":{"filename":"src/cligen/command_node/command_meta.cr","line_number":5,"url":null},"def":{"name":"copy_with","args":[{"name":"_cls","default_value":"@cls","external_name":"cls","restriction":""}],"visibility":"Public","body":"self.class.new(_cls)"},"external_var":false}]},{"html_id":"CliGenerator/CliGen/CommandNode","path":"CliGen/CommandNode.html","kind":"class","full_name":"CliGen::CommandNode(T)","name":"CommandNode","abstract":false,"superclass":{"html_id":"CliGenerator/CliGen/BaseCommandNode","kind":"class","full_name":"CliGen::BaseCommandNode","name":"BaseCommandNode"},"ancestors":[{"html_id":"CliGenerator/CliGen/BaseCommandNode","kind":"class","full_name":"CliGen::BaseCommandNode","name":"BaseCommandNode"},{"html_id":"CliGenerator/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"CliGenerator/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cligen/command_node.cr","line_number":14,"url":null}],"repository_name":"CliGenerator","program":false,"enum":false,"alias":false,"const":false,"subclasses":[{"html_id":"CliGenerator/CliGen/App","kind":"class","full_name":"CliGen::App","name":"App"}],"namespace":{"html_id":"CliGenerator/CliGen","kind":"module","full_name":"CliGen","name":"CliGen"},"constructors":[{"html_id":"new(name:String,flags:Array(BaseFlag),commands:Array(BaseCommandNode),pre_run_commands:Array(RunCommand),post_run_commands:Array(RunCommand),parent:BaseCommandNode|Nil=nil,description:String|Nil=nil)-class-method","name":"new","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"String"},{"name":"flags","external_name":"flags","restriction":"Array(BaseFlag)"},{"name":"commands","external_name":"commands","restriction":"Array(BaseCommandNode)"},{"name":"pre_run_commands","external_name":"pre_run_commands","restriction":"Array(RunCommand)"},{"name":"post_run_commands","external_name":"post_run_commands","restriction":"Array(RunCommand)"},{"name":"parent","default_value":"nil","external_name":"parent","restriction":"BaseCommandNode | ::Nil"},{"name":"description","default_value":"nil","external_name":"description","restriction":"String | ::Nil"}],"args_string":"(name : String, flags : Array(BaseFlag), commands : Array(BaseCommandNode), pre_run_commands : Array(RunCommand), post_run_commands : Array(RunCommand), parent : BaseCommandNode | Nil = nil, description : String | Nil = nil)","args_html":"(name : String, flags : Array(BaseFlag), commands : Array(BaseCommandNode), pre_run_commands : Array(RunCommand), post_run_commands : Array(RunCommand), parent : BaseCommandNode | Nil = nil, description : String | Nil = nil)","location":{"filename":"src/cligen/command_node.cr","line_number":15,"url":null},"def":{"name":"new","args":[{"name":"name","external_name":"name","restriction":"String"},{"name":"flags","external_name":"flags","restriction":"Array(BaseFlag)"},{"name":"commands","external_name":"commands","restriction":"Array(BaseCommandNode)"},{"name":"pre_run_commands","external_name":"pre_run_commands","restriction":"Array(RunCommand)"},{"name":"post_run_commands","external_name":"post_run_commands","restriction":"Array(RunCommand)"},{"name":"parent","default_value":"nil","external_name":"parent","restriction":"BaseCommandNode | ::Nil"},{"name":"description","default_value":"nil","external_name":"description","restriction":"String | ::Nil"}],"visibility":"Public","body":"_ = CommandNode(T).allocate\n_.initialize(name, flags, commands, pre_run_commands, post_run_commands, parent, description)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"},"external_var":false}],"instance_methods":[{"html_id":"check!:Nil-instance-method","name":"check!","abstract":false,"location":{"filename":"src/cligen/command_node.cr","line_number":80,"url":null},"def":{"name":"check!","return_type":"Nil","visibility":"Public","body":"@flags.each(&.check!)\ncheck_for_duplicate_flags!(@flags + CliGen::GLOBAL_FLAGS)\n@commands.each(&.check!)\ncheck_for_duplicate_subcommands!\n\n{% unless T == Nil %}\n raise CliGen::MissingDispatchError.new(\"CommandNode(#{@name})#check! : {{ T }} has no subcommands and no #main defined\") \\\n if subcommands.empty? && !{{ T.has_method?(:main) }}\n {% end %}\n"},"external_var":false},{"html_id":"help:String-instance-method","name":"help","abstract":false,"location":{"filename":"src/cligen/command_node.cr","line_number":64,"url":null},"def":{"name":"help","return_type":"String","visibility":"Public","body":"{% if true %}\n {% if T.has_constant?(\"HELP_TEMPLATE\") %}\n {% if env(\"DEBUG\")\n puts(\"#{T} was found to have HELP_TEMPLATE defined using this instead\")\nend %}\n ECR.render({{ T.constant(\"HELP_TEMPLATE\") }})\n {% elsif CliGen.has_constant?(\"HELP_OVERRIDE_TEMPLATE\") %} # If we have a global override use it\n {% if env(\"DEBUG\")\n puts(\"Global override found. Using\")\nend %}\n ECR.render({{ CliGen::HELP_OVERRIDE_TEMPLATE }})\n {% else %}\n {% if env(\"DEBUG\")\n puts(\"No type overrided help output. Using default\")\nend %}\n ECR.render(\"lib/cligen/src/cligen/template/cmd_help.ecr\")\n {% end %} # otherwise\n {% if env(\"DEBUG\")\n debug\nend %}\n {% end %}"},"external_var":false},{"html_id":"process(args:Array(CliGen::Arg)):Nil-instance-method","name":"process","abstract":false,"args":[{"name":"args","external_name":"args","restriction":"Array(CliGen::Arg)"}],"args_string":"(args : Array(CliGen::Arg)) : Nil","args_html":"(args : Array(CliGen::Arg)) : Nil","location":{"filename":"src/cligen/command_node.cr","line_number":92,"url":null},"def":{"name":"process","args":[{"name":"args","external_name":"args","restriction":"Array(CliGen::Arg)"}],"return_type":"Nil","visibility":"Public","body":"Log.trace do \"CommandNode(#{@name})#process(#{args.map(&.value)}) : Entered\" end\ncheck!\npassed_execution = false\nmatched_subcommand : String | ::Nil = nil\n\n@pre_run_commands.each(&.call)\n\nargs.each do |arg|\n Log.trace do \"CommandNode(#{@name})#process : Iterating with arg Arg(index: #{arg.index}, value: #{arg.value})\" end\n if arg.processed?\n Log.debug do \"CommandNode(#{@name})#process : Arg(#{arg.value}) was already processed. Skipping\" end\n next\n end\n Log.trace do \"CommandNode(#{@name})#process : Arg(#{arg.value}) wasn't processed yet. Continuing and marking arg as processed\" end\n arg.processed\n\n case match = find_match(arg.value)\n when BaseCommandNode\n Log.trace do\n \"CommandNode(#{@name})#process : Arg(#{arg.value}) was found to be a child command. Handing off rest of execution & parsing to it\"\n end\n\n {% if true %}\n case match\n {% for cls in CliGen::Command.subclasses %}\n when CliGen::CommandNode({{ cls.name }})\n match.as(CommandNode({{ cls }})).process(args.reject(&.processed?))\n exit 0\n {% end %}\n else\n raise CliGen::UnknownCommandNodeError.new(\"CommandNode(#{@name})#process : matched a BaseCommandNode that isn't a known CommandNode(T)\")\n end\n {% end %}\n passed_execution = true\n when BaseFlag\n Log.trace do \"CommandNode(#{@name})#process : Arg(#{arg.value}) was found to be a flag\" end\n\n\n handle_flag_raises do\n if match.requires_arg?\n Log.trace do \"CommandNode(#{@name})#process : Arg(#{arg.value}) flag requires values so handing it the data without a match or that matches it's valid options\" end\n match.process(args.reject(&.processed?).take_while do |v|\n ((find_match(v.value)) == CliGen::MatchType::NoMatch) || (!!match.meta.options.try(&.includes?(v.value)))\n end)\n else\n Log.trace do \"CommandNode(#{@name})#process : Arg(#{arg.value}) flag does not require an argument so just calling process\" end\n match.process\n end\n end\n when MatchType::SubCommand\n Log.trace do \"CommandNode(#{@name})#process : Arg(#{arg.value}) was found to be a subcomand. Marking it as the matched sub-command\" end\n if matched_subcommand\n raise(CliGen::InternalError.new(\"CommandNode(#{@name})#process : subcommand '#{matched_subcommand}' was already matched — duplicate subcommand token\"))\n end\n matched_subcommand = arg.value\n when MatchType::FlagWithArg\n Log.debug do \"CommandNode(#{@name})#process : Arg(#{arg.value}) was found to be a flag with an argDuplicate command names detected during check!
"},{"html_id":"CliGenerator/CliGen/DuplicateFlagError","path":"CliGen/DuplicateFlagError.html","kind":"class","full_name":"CliGen::DuplicateFlagError","name":"DuplicateFlagError","abstract":false,"superclass":{"html_id":"CliGenerator/CliGen/ConfigurationError","kind":"class","full_name":"CliGen::ConfigurationError","name":"ConfigurationError"},"ancestors":[{"html_id":"CliGenerator/CliGen/ConfigurationError","kind":"class","full_name":"CliGen::ConfigurationError","name":"ConfigurationError"},{"html_id":"CliGenerator/CliGen/Error","kind":"class","full_name":"CliGen::Error","name":"Error"},{"html_id":"CliGenerator/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"CliGenerator/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"CliGenerator/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cligen/exceptions.cr","line_number":33,"url":null}],"repository_name":"CliGenerator","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"CliGenerator/CliGen","kind":"module","full_name":"CliGen","name":"CliGen"},"doc":"Duplicate short or long flags detected during check!","summary":"Duplicate short or long flags detected during check!
"},{"html_id":"CliGenerator/CliGen/Error","path":"CliGen/Error.html","kind":"class","full_name":"CliGen::Error","name":"Error","abstract":false,"superclass":{"html_id":"CliGenerator/Exception","kind":"class","full_name":"Exception","name":"Exception"},"ancestors":[{"html_id":"CliGenerator/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"CliGenerator/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"CliGenerator/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cligen/exceptions.cr","line_number":6,"url":null}],"repository_name":"CliGenerator","program":false,"enum":false,"alias":false,"const":false,"subclasses":[{"html_id":"CliGenerator/CliGen/ConfigurationError","kind":"class","full_name":"CliGen::ConfigurationError","name":"ConfigurationError"},{"html_id":"CliGenerator/CliGen/HelpRequestedError","kind":"class","full_name":"CliGen::HelpRequestedError","name":"HelpRequestedError"},{"html_id":"CliGenerator/CliGen/InternalError","kind":"class","full_name":"CliGen::InternalError","name":"InternalError"},{"html_id":"CliGenerator/CliGen/RuntimeError","kind":"class","full_name":"CliGen::RuntimeError","name":"RuntimeError"}],"namespace":{"html_id":"CliGenerator/CliGen","kind":"module","full_name":"CliGen","name":"CliGen"},"doc":"Base for all CliGen exceptions","summary":"Base for all CliGen exceptions
"},{"html_id":"CliGenerator/CliGen/Flag","path":"CliGen/Flag.html","kind":"class","full_name":"CliGen::Flag(T)","name":"Flag","abstract":false,"superclass":{"html_id":"CliGenerator/CliGen/BaseFlag","kind":"class","full_name":"CliGen::BaseFlag","name":"BaseFlag"},"ancestors":[{"html_id":"CliGenerator/CliGen/BaseFlag","kind":"class","full_name":"CliGen::BaseFlag","name":"BaseFlag"},{"html_id":"CliGenerator/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"CliGenerator/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cligen/flag.cr","line_number":10,"url":null}],"repository_name":"CliGenerator","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"CliGenerator/CliGen","kind":"module","full_name":"CliGen","name":"CliGen"},"constructors":[{"html_id":"new(var:String,short:String|Nil,long:String,env_var:String|Nil,description:String,delimiter:String=\",\",default:T|Nil=nil,options:Array(T)|Nil=nil,validate:T->Bool|Nil=nil,on_match:Proc(T,Nil)|Nil=nil,format:::Regex|Nil=nil)-class-method","name":"new","abstract":false,"args":[{"name":"var","external_name":"var","restriction":"String"},{"name":"short","external_name":"short","restriction":"String | ::Nil"},{"name":"long","external_name":"long","restriction":"String"},{"name":"env_var","external_name":"env_var","restriction":"String | ::Nil"},{"name":"description","external_name":"description","restriction":"String"},{"name":"delimiter","default_value":"\",\"","external_name":"delimiter","restriction":"String"},{"name":"default","default_value":"nil","external_name":"default","restriction":"T | ::Nil"},{"name":"options","default_value":"nil","external_name":"options","restriction":"Array(T) | ::Nil"},{"name":"validate","default_value":"nil","external_name":"validate","restriction":"(T -> Bool) | ::Nil"},{"name":"on_match","default_value":"nil","external_name":"on_match","restriction":"Proc(T, Nil) | ::Nil"},{"name":"format","default_value":"nil","external_name":"format","restriction":"::Regex | ::Nil"}],"args_string":"(var : String, short : String | Nil, long : String, env_var : String | Nil, description : String, delimiter : String = \",\", default : T | Nil = nil, options : Array(T) | Nil = nil, validate : T -> Bool | Nil = nil, on_match : Proc(T, Nil) | Nil = nil, format : ::Regex | Nil = nil)","args_html":"(var : String, short : String | Nil, long : String, env_var : String | Nil, description : String, delimiter : String = ",", default : T | Nil = nil, options : Array(T) | Nil = nil, validate : T -> Bool | Nil = nil, on_match : Proc(T, Nil) | Nil = nil, format : ::Regex | Nil = nil)","location":{"filename":"src/cligen/flag.cr","line_number":18,"url":null},"def":{"name":"new","args":[{"name":"var","external_name":"var","restriction":"String"},{"name":"short","external_name":"short","restriction":"String | ::Nil"},{"name":"long","external_name":"long","restriction":"String"},{"name":"env_var","external_name":"env_var","restriction":"String | ::Nil"},{"name":"description","external_name":"description","restriction":"String"},{"name":"delimiter","default_value":"\",\"","external_name":"delimiter","restriction":"String"},{"name":"default","default_value":"nil","external_name":"default","restriction":"T | ::Nil"},{"name":"options","default_value":"nil","external_name":"options","restriction":"Array(T) | ::Nil"},{"name":"validate","default_value":"nil","external_name":"validate","restriction":"(T -> Bool) | ::Nil"},{"name":"on_match","default_value":"nil","external_name":"on_match","restriction":"Proc(T, Nil) | ::Nil"},{"name":"format","default_value":"nil","external_name":"format","restriction":"::Regex | ::Nil"}],"visibility":"Public","body":"_ = Flag(T).allocate\n_.initialize(var, short, long, env_var, description, delimiter, default, options, validate, on_match, format)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"},"external_var":false}],"instance_methods":[{"html_id":"check!:Nil-instance-method","name":"check!","abstract":false,"location":{"filename":"src/cligen/flag.cr","line_number":258,"url":null},"def":{"name":"check!","return_type":"Nil","visibility":"Public","body":"Log.trace do \"Flag(long: #{@long}, type: #{@meta.type})#check! : called\" end\nif short = @short\n if short =~ CliGen::Regex::FLAG_SHORT\n else\n raise(CliGen::ConfigurationError.new(\"Flag({{T}}, long: #{@long})#check! : #{short} must match be a single \\\"-\\\" followed by a single character [a-zA-Z]. Valid pattern (#{CliGen::Regex::FLAG_SHORT.source})\"))\n end\nend\nif long_key =~ CliGen::Regex::FLAG_LONG\nelse\n raise(CliGen::ConfigurationError.new(\"Flag({{T}}, long: #{@long})#check! : flag long (#{long_key}) must begin with \\\"--\\\" followed by a series of alphanumeric characters and/or \\\"-\\\". Valid pattern (#{CliGen::Regex::FLAG_LONG.source})\"))\nend\n\n\n\n\nif ([\"--verbose\", \"--help\"] of ::String).includes?(@long_key)\n raise(CliGen::ReservedFlagError.new(\"Flag({{T}}, long: #{@long})#check! : Long(#{@long_key}) is a reserved long flag. You will need to use another\"))\nend\n\nif short = @short\n if ([\"-v\", \"-h\"] of ::String).includes?(short)\n raise(CliGen::ReservedFlagError.new(\"Flag({{T}}, long: #{@long})#check! : Long(#{@short}) is a reserved short flag. You will need to use another\"))\n end\nend\n"},"external_var":false},{"html_id":"process(argv:Array(Arg)=[]ofArg):Nil-instance-method","name":"process","abstract":false,"args":[{"name":"argv","default_value":"[] of Arg","external_name":"argv","restriction":"Array(Arg)"}],"args_string":"(argv : Array(Arg) = [] of Arg) : Nil","args_html":"(argv : Array(Arg) = [] of Arg) : Nil","location":{"filename":"src/cligen/flag.cr","line_number":61,"url":null},"def":{"name":"process","args":[{"name":"argv","default_value":"[] of Arg","external_name":"argv","restriction":"Array(Arg)"}],"return_type":"Nil","visibility":"Public","body":"Log.trace do \"Flag(#{@long}, type: #{@meta.type})#process : entered with args #{argv.map(&.value)}\" end\nif requires_arg?\n if argv.empty?\n raise(CliGen::FlagMissingArgumentError.new(\"Flag(#{T}, long: #{@long_key}) : requires an argument but provided array is empty\"))\n end\n if argv.first.flag?\n raise(CliGen::FlagArgumentError.new(\"Flag(#{T}, long: #{@long_key}) : a flag token was provided where a value was expected (got: #{argv.first.value})\"))\n end\nend\n\n{% if T == Bool %}\n @value = true\n {% elsif T < Array %}\n {% if T.type_vars.size > 1\n raise(\"ERROR : Flag(#{T}) : You cannot define multiple types of array entries\")\nend %}\n {% elem = T.type_vars.first %}\n Log.debug { \"Flag(long: #{@long}, type: #{@meta.type})#process : Beginning iteration of arguments\" }\n argv.each do |arg|\n Log.trace { \"Flag(long: #{@long}, type: #{@meta.type})#process : Iterating with Arg(index: #{arg.index}, value: #{arg.value})\" }\n if arg.flag?\n Log.debug { \"Flag(long: #{@long}, type: #{@meta.type})#process : Arg(index: #{arg.index}, value: #{arg.value}) was a flag. Breaking loop\" }\n break \n end\n unless @format.nil?\n Log.debug { \"Flag(long: #{@long}, type: #{@meta.type}) : Arg(index: #{arg.index}, value: #{arg.value}) format regex was provided. Going to check argument value against it\" }\n unless arg.value.includes?(@delimiter)\n unless arg.value =~ @format\n Log.debug { \"Flag(long: #{@long}, type: #{@meta.type}) : Arg(index: #{arg.index}, value: #{arg.value}) was not found to be matching the defined filter #{@format}. So breaking from parse loop\" }\n break\n end\n end\n end\n {% if elem < Int %}\n {% int_case = elem.stringify =~ (/^UInt/) ? \"uint?\".id : \"int?\".id %}\n if arg.value.includes?(@delimiter)\n Log.debug { \"Flag(long: #{@long}, type: #{@meta.type})#process : Arg(index: #{arg.index}, value: #{arg.value}) argument provided is delimited with provided delimiter . Splitting and parsing individual values\" }\n @value = (@value || T.new) + arg.value.split(@delimiter).map do |val|\n Log.trace { \"Flag(long: #{@long}, type: #{@meta.type})#process : Arg(index: #{arg.index}, value: #{arg.value}) : Indexing with Value(#{val})\" }\n val = val.strip\n unless arg.{{ int_case }}(val)\n raise CliGen::InvalidFlagValueError.new(\"Flag({{ T }}, long: #{@long_key}) : '#{val}' is not a valid {{ elem }}\")\n end\n {{ elem }}.new(val)\n end\n else\n unless arg.{{ int_case }}\n raise CliGen::InvalidFlagValueError.new(\"Flag({{ T }}, long: #{@long_key}) : '#{arg.value}' is not a valid {{ T }}\") \n end\n (@value ||= T.new) << {{ elem }}.new(arg.value)\n end\n {% elsif elem < Float %}\n if arg.value.includes?(@delimiter)\n @value = (@value || T.new) + arg.value.split(@delimiter).map do |val|\n val = val.strip\n unless CliGen::Arg.float?(val)\n raise CliGen::InvalidFlagValueError.new(\"Flag({{ T }}, long: #{@long_key}) : '#{val}' is not a valid {{ T }}\")\n end\n {{ elem }}.new(val)\n end\n else\n unless arg.float?\n raise CliGen::InvalidFlagValueError.new(\"Flag({{ T }}, long: #{@long_key}) : '#{arg.value}' is not a float\") \n end\n (@value ||= T.new) << {{ elem }}.new(arg.value)\n end\n {% elsif elem == String %}\n if arg.value.includes?(@delimiter)\n Log.debug { \"Flag(long: #{@long}, type: #{@meta.type})#process : Arg(index: #{arg.index}, value: #{arg.value}) argument provided is delimited with provided delimiter . Splitting and parsing individual values\" }\n @value = (@value || [] of String) + arg.value.split(@delimiter).map { |v|\n Log.trace { \"Flag(long: #{@long}, type: #{@meta.type})#process : Arg(index: #{arg.index}, value: #{arg.value}) : Indexing with Value(#{v})\" }\n unless @format.nil?\n Log.debug { \"Flag(long: #{@long}, type: #{@meta.type})#process : Arg(index: #{arg.index}, value: #{arg.value}) format regex (#{@format.not_nil!.source}) was provided. Checking value against it\" }\n raise CliGen::InvalidFlagValueError.new(\"Flag({{ T }}, long: #{@long_key}) : '#{v}' does not match required format /#{@format.not_nil!.source}/\") unless v =~ @format\n end\n v\n }\n else\n if ! @format.nil? && arg.value !~ @format\n raise CliGen::InvalidFlagValueError.new(\"Flag({{ T }}, long: #{@long_key}) : '#{arg.value}' does not match required format /#{@format.not_nil!.source}/\") \n end\n (@value ||= [] of String) << arg.value\n end\n {% elsif elem.class < CliGen::Coercable %}\n if arg.value.includes?(@delimiter)\n @value = (@value || [] of {{ elem }}) + arg.value.split(@delimiter).map { |i| {{ elem }}.coerce(i) }\n else\n @value = (@value || [] of {{ elem }}) + [({{ elem }}.coerce(arg.value))]\n end\n {% else %}\n {% raise(\"ERROR : Flag(#{T}) : #{elem} is not a coercable type. If you wish to coerce it from a bare string extend with CliGen::Coercable & implement the class method\") %}\n {% end %}\n arg.processed\n end\n {% elsif T < Int %}\n {% int_case = T.stringify =~ (/^UInt/) ? \"uint?\".id : \"int?\".id %}\n unless argv.first.{{ int_case }}\n raise CliGen::InvalidFlagValueError.new(\"Flag(#{T}, long: #{@long_key}) : '#{argv.first.value}' is not a valid {{ T }}\") \n end\n @value = T.new(argv.first.value)\n argv.first.processed\n {% elsif T < Float %}\n unless argv.first.float?\n raise CliGen::InvalidFlagValueError.new(\"Flag(#{T}, long: #{@long_key}) : '#{argv.first.value}' is not a valid {{ T }}\") \n end\n @value = T.new(argv.first.value)\n argv.first.processed\n {% elsif T == Time %}\n begin\n @value = ::CliGen::Timeparse.parse(argv.first.value)\n argv.first.processed\n rescue e : ::CliGen::TimeParseError\n raise CliGen::InvalidFlagValueError.new(\"Flag(#{T}, long: #{@long_key}) : #{e.message}\") \n end\n {% elsif T == String %} # String\n if ! @format.nil? && argv.first.value !~ @format\n raise CliGen::InvalidFlagValueError.new(\"Flag(#{T}, long: #{@long_key}) : '#{argv.first.value}' does not match required format /#{@format.not_nil!.source}/\") \n end\n\n @value = argv.first.value\n argv.first.processed\n {% elsif T.class < CliGen::Parsable %}\n unprocessed = argv.reject(&.processed?)\n Log.trace { \"Flag(long: #{@long}, type: #{@meta.type})#process : unprocessed before : #{unprocessed.map(&.value)}\" }\n @value = T.parse_args(argv)\n Log.trace { \"Flag(long: #{@long}, type: #{@meta.type})#process : unprocessed after : #{unprocessed.reject(&.processed?).map(&.value)}\" }\n # Essentially if the unprocessed array stays the same (aka if it shows the same number of unprocessed\n # arguments it will complain and raise. Only possible because the array holds references to the objects\n # in case the user (for some reason) shifts/pops options out when getting/parsing data from argv)\n if unprocessed.size == unprocessed.reject(&.processed?).size\n raise CliGen::ParseableInvariantError.new(\"Flag({{ T }}, long: #{@long_key})#process : {{ T }}#parse_args did not mark any args as processed\")\n end\n {% else %}\n {% raise(\"ERROR : Flag({{T}}#process : Generic Type #{T} is not supported. To add support you must extend with CliGen::Parsable & implement the class method\") %}\n {% end %}\n\nvalidate!\n@on_match.try(&.call(value!))\n"},"external_var":false},{"html_id":"raw_value:String|Nil-instance-method","name":"raw_value","abstract":false,"location":{"filename":"src/cligen/flag.cr","line_number":220,"url":null},"def":{"name":"raw_value","return_type":"String | ::Nil","visibility":"Public","body":"Log.trace do \"Flag(long: #{@long}, type: #{@meta.type})#raw_value : called\" end\n{% if T == Bool %}\n @value.try(&.to_s)\n {% elsif T <= Array %}\n @value.try(&.join(\",\"))\n {% else %}\n @value.try(&.to_s)\n {% end %}\n"},"external_var":false},{"html_id":"requires_arg?:Bool-instance-method","name":"requires_arg?","abstract":false,"location":{"filename":"src/cligen/flag.cr","line_number":57,"url":null},"def":{"name":"requires_arg?","return_type":"Bool","visibility":"Public","body":"({{ T }}) != Bool"},"external_var":false},{"html_id":"satisfied?:Bool-instance-method","name":"satisfied?","abstract":false,"location":{"filename":"src/cligen/flag.cr","line_number":231,"url":null},"def":{"name":"satisfied?","return_type":"Bool","visibility":"Public","body":"Log.trace do \"Flag(long: #{@long}, type: #{@meta.type})#satisfied? : called\" end\nif !@value.nil?\n return true\nend\nif (!@env_var.nil?) && ENV[@env_var.not_nil!]?\n return true\nend\nif !@default.nil?\n return true\nend\nfalse\n"},"external_var":false},{"html_id":"validate!(v:T|Nil=nil):Nil-instance-method","name":"validate!","abstract":false,"args":[{"name":"v","default_value":"nil","external_name":"v","restriction":"T | ::Nil"}],"args_string":"(v : T | Nil = nil) : Nil","args_html":"(v : T | Nil = nil) : Nil","location":{"filename":"src/cligen/flag.cr","line_number":239,"url":null},"def":{"name":"validate!","args":[{"name":"v","default_value":"nil","external_name":"v","restriction":"T | ::Nil"}],"return_type":"Nil","visibility":"Public","body":"Log.trace do \"Flag(long: #{@long}, type: #{@meta.type})#validate! : called\" end\nif v.nil?\n v = value!\nend\n\nif opts = @options\n {% if T < Array %}\n v.each do |v2|\n raise CliGen::InvalidOptionError.new(\"#{CliGen::APPNAME}: '#{v2}' is not a valid value for #{@long_key} (valid: #{opts.first.join(\", \")})\") unless opts.first.includes?(v2)\n end\n {% else %}\n raise CliGen::InvalidOptionError.new(\"#{CliGen::APPNAME}: '#{v}' is not a valid value for #{@long_key} (valid: #{opts.join(\", \")})\") unless opts.includes?(v)\n {% end %}\nend\n\nif check = @validate\n if check.call(v)\n else\n raise(CliGen::ValidationError.new(\"#{CliGen::APPNAME}: validation failed for #{@long_key} (got: #{v})\"))\n end\nend\n"},"external_var":false},{"html_id":"value!:T-instance-method","name":"value!","abstract":false,"location":{"filename":"src/cligen/flag.cr","line_number":196,"url":null},"def":{"name":"value!","return_type":"T","visibility":"Public","body":"Log.trace do \"Flag(long: #{@long}, type: #{@meta.type})#value! : called\" end\n\nv = @value\n\n\nif v.nil?\n if var = @env_var\n if raw = ENV[var]?\n v = coerce(raw)\n end\n end\nend\n\nv || (v = @default)\n\nif v.nil?\n raise(CliGen::MissingRequiredFlagError.new(\"#{CliGen::APPNAME}: required flag #{@long_key} was not provided\"))\nend\n\nvalidate!(v)\n\nv.not_nil!\n"},"external_var":false}]},{"html_id":"CliGenerator/CliGen/FlagArgumentError","path":"CliGen/FlagArgumentError.html","kind":"class","full_name":"CliGen::FlagArgumentError","name":"FlagArgumentError","abstract":false,"superclass":{"html_id":"CliGenerator/CliGen/RuntimeError","kind":"class","full_name":"CliGen::RuntimeError","name":"RuntimeError"},"ancestors":[{"html_id":"CliGenerator/CliGen/RuntimeError","kind":"class","full_name":"CliGen::RuntimeError","name":"RuntimeError"},{"html_id":"CliGenerator/CliGen/Error","kind":"class","full_name":"CliGen::Error","name":"Error"},{"html_id":"CliGenerator/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"CliGenerator/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"CliGenerator/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cligen/exceptions.cr","line_number":63,"url":null}],"repository_name":"CliGenerator","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"CliGenerator/CliGen","kind":"module","full_name":"CliGen","name":"CliGen"},"doc":"A flag token was provided where a value argument was expected","summary":"A flag token was provided where a value argument was expected
"},{"html_id":"CliGenerator/CliGen/FlagBundleError","path":"CliGen/FlagBundleError.html","kind":"class","full_name":"CliGen::FlagBundleError","name":"FlagBundleError","abstract":false,"superclass":{"html_id":"CliGenerator/CliGen/RuntimeError","kind":"class","full_name":"CliGen::RuntimeError","name":"RuntimeError"},"ancestors":[{"html_id":"CliGenerator/CliGen/RuntimeError","kind":"class","full_name":"CliGen::RuntimeError","name":"RuntimeError"},{"html_id":"CliGenerator/CliGen/Error","kind":"class","full_name":"CliGen::Error","name":"Error"},{"html_id":"CliGenerator/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"CliGenerator/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"CliGenerator/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cligen/exceptions.cr","line_number":75,"url":null}],"repository_name":"CliGenerator","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"CliGenerator/CliGen","kind":"module","full_name":"CliGen","name":"CliGen"},"doc":"A flag that requires an argument was included in a short-flag bundle","summary":"A flag that requires an argument was included in a short-flag bundle
"},{"html_id":"CliGenerator/CliGen/FlagMeta","path":"CliGen/FlagMeta.html","kind":"struct","full_name":"CliGen::FlagMeta","name":"FlagMeta","abstract":false,"superclass":{"html_id":"CliGenerator/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"CliGenerator/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"CliGenerator/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"CliGenerator/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cligen/flag/meta.cr","line_number":6,"url":null}],"repository_name":"CliGenerator","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"CliGenerator/CliGen","kind":"module","full_name":"CliGen","name":"CliGen"},"doc":"To be able to store metadata for use in the help output","summary":"To be able to store metadata for use in the help output
","constructors":[{"html_id":"new(type:String,array:Bool,format:String|Nil,default:String,options:Array(String)|Nil)-class-method","name":"new","abstract":false,"args":[{"name":"type","external_name":"type","restriction":"String"},{"name":"array","external_name":"array","restriction":"Bool"},{"name":"format","external_name":"format","restriction":"String | ::Nil"},{"name":"default","external_name":"default","restriction":"String"},{"name":"options","external_name":"options","restriction":"Array(String) | ::Nil"}],"args_string":"(type : String, array : Bool, format : String | Nil, default : String, options : Array(String) | Nil)","args_html":"(type : String, array : Bool, format : String | Nil, default : String, options : Array(String) | Nil)","location":{"filename":"src/cligen/flag/meta.cr","line_number":6,"url":null},"def":{"name":"new","args":[{"name":"type","external_name":"type","restriction":"String"},{"name":"array","external_name":"array","restriction":"Bool"},{"name":"format","external_name":"format","restriction":"String | ::Nil"},{"name":"default","external_name":"default","restriction":"String"},{"name":"options","external_name":"options","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"_ = allocate\n_.initialize(type, array, format, default, options)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"},"external_var":false}],"instance_methods":[{"html_id":"array:Bool-instance-method","name":"array","abstract":false,"def":{"name":"array","return_type":"Bool","visibility":"Public","body":"@array"},"external_var":false},{"html_id":"clone-instance-method","name":"clone","abstract":false,"location":{"filename":"src/cligen/flag/meta.cr","line_number":6,"url":null},"def":{"name":"clone","visibility":"Public","body":"self.class.new(@type.clone, @array.clone, @format.clone, @default.clone, @options.clone)"},"external_var":false},{"html_id":"copy_with(type_type=@type,array_array=@array,format_format=@format,default_default=@default,options_options=@options)-instance-method","name":"copy_with","abstract":false,"args":[{"name":"_type","default_value":"@type","external_name":"type","restriction":""},{"name":"_array","default_value":"@array","external_name":"array","restriction":""},{"name":"_format","default_value":"@format","external_name":"format","restriction":""},{"name":"_default","default_value":"@default","external_name":"default","restriction":""},{"name":"_options","default_value":"@options","external_name":"options","restriction":""}],"args_string":"(type _type = @type, array _array = @array, format _format = @format, default _default = @default, options _options = @options)","args_html":"(type _type = @type, array _array = @array, format _format = @format, default _default = @default, options _options = @options)","location":{"filename":"src/cligen/flag/meta.cr","line_number":6,"url":null},"def":{"name":"copy_with","args":[{"name":"_type","default_value":"@type","external_name":"type","restriction":""},{"name":"_array","default_value":"@array","external_name":"array","restriction":""},{"name":"_format","default_value":"@format","external_name":"format","restriction":""},{"name":"_default","default_value":"@default","external_name":"default","restriction":""},{"name":"_options","default_value":"@options","external_name":"options","restriction":""}],"visibility":"Public","body":"self.class.new(_type, _array, _format, _default, _options)"},"external_var":false},{"html_id":"default:String-instance-method","name":"default","abstract":false,"def":{"name":"default","return_type":"String","visibility":"Public","body":"@default"},"external_var":false},{"html_id":"format:String|Nil-instance-method","name":"format","abstract":false,"def":{"name":"format","return_type":"String | ::Nil","visibility":"Public","body":"@format"},"external_var":false},{"html_id":"options:Array(String)|Nil-instance-method","name":"options","abstract":false,"def":{"name":"options","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@options"},"external_var":false},{"html_id":"type:String-instance-method","name":"type","abstract":false,"def":{"name":"type","return_type":"String","visibility":"Public","body":"@type"},"external_var":false}]},{"html_id":"CliGenerator/CliGen/FlagMissingArgumentError","path":"CliGen/FlagMissingArgumentError.html","kind":"class","full_name":"CliGen::FlagMissingArgumentError","name":"FlagMissingArgumentError","abstract":false,"superclass":{"html_id":"CliGenerator/CliGen/ConfigurationError","kind":"class","full_name":"CliGen::ConfigurationError","name":"ConfigurationError"},"ancestors":[{"html_id":"CliGenerator/CliGen/ConfigurationError","kind":"class","full_name":"CliGen::ConfigurationError","name":"ConfigurationError"},{"html_id":"CliGenerator/CliGen/Error","kind":"class","full_name":"CliGen::Error","name":"Error"},{"html_id":"CliGenerator/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"CliGenerator/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"CliGenerator/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cligen/exceptions.cr","line_number":45,"url":null}],"repository_name":"CliGenerator","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"CliGenerator/CliGen","kind":"module","full_name":"CliGen","name":"CliGen"},"doc":"A flag that requires an argument was processed with an empty argv","summary":"A flag that requires an argument was processed with an empty argv
"},{"html_id":"CliGenerator/CliGen/FlagNotFoundError","path":"CliGen/FlagNotFoundError.html","kind":"class","full_name":"CliGen::FlagNotFoundError","name":"FlagNotFoundError","abstract":false,"superclass":{"html_id":"CliGenerator/CliGen/ConfigurationError","kind":"class","full_name":"CliGen::ConfigurationError","name":"ConfigurationError"},"ancestors":[{"html_id":"CliGenerator/CliGen/ConfigurationError","kind":"class","full_name":"CliGen::ConfigurationError","name":"ConfigurationError"},{"html_id":"CliGenerator/CliGen/Error","kind":"class","full_name":"CliGen::Error","name":"Error"},{"html_id":"CliGenerator/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"CliGenerator/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"CliGenerator/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cligen/exceptions.cr","line_number":42,"url":null}],"repository_name":"CliGenerator","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"CliGenerator/CliGen","kind":"module","full_name":"CliGen","name":"CliGen"},"doc":"No flag was found in the handler for a Command ivar during initialize","summary":"No flag was found in the handler for a Command ivar during initialize
"},{"html_id":"CliGenerator/CliGen/Format","path":"CliGen/Format.html","kind":"module","full_name":"CliGen::Format","name":"Format","abstract":false,"locations":[{"filename":"src/cligen/format.cr","line_number":5,"url":null}],"repository_name":"CliGenerator","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"INPUT_DATE_FULL","name":"INPUT_DATE_FULL","value":"\"%Y-%m-%d %H:%M:%S %z\""},{"id":"INPUT_DATE_PARTIAL","name":"INPUT_DATE_PARTIAL","value":"\"%Y-%m-%d %H:%M:%S\""},{"id":"INPUT_DATE_SIMPLE","name":"INPUT_DATE_SIMPLE","value":"\"%Y-%m-%d\""},{"id":"INPUT_DATE_SIMPLE_WITH_TIMEZONE","name":"INPUT_DATE_SIMPLE_WITH_TIMEZONE","value":"\"%Y-%m-%d %z\""},{"id":"INPUT_EPOCH","name":"INPUT_EPOCH","value":"\"@%s\""}],"namespace":{"html_id":"CliGenerator/CliGen","kind":"module","full_name":"CliGen","name":"CliGen"},"doc":"This module just holds time formats to be used with ::Time.parse!/.parse/.parse_local","summary":"This module just holds time formats to be used with ::Time.parse!/.parse/.parse_local
"},{"html_id":"CliGenerator/CliGen/HelpRequestedError","path":"CliGen/HelpRequestedError.html","kind":"class","full_name":"CliGen::HelpRequestedError","name":"HelpRequestedError","abstract":false,"superclass":{"html_id":"CliGenerator/CliGen/Error","kind":"class","full_name":"CliGen::Error","name":"Error"},"ancestors":[{"html_id":"CliGenerator/CliGen/Error","kind":"class","full_name":"CliGen::Error","name":"Error"},{"html_id":"CliGenerator/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"CliGenerator/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"CliGenerator/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cligen/exceptions.cr","line_number":82,"url":null}],"repository_name":"CliGenerator","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"CliGenerator/CliGen","kind":"module","full_name":"CliGen","name":"CliGen"},"doc":"Raised when -h/--help is matched; carries the rendered help string","summary":"Raised when -h/--help is matched; carries the rendered help string
"},{"html_id":"CliGenerator/CliGen/InternalError","path":"CliGen/InternalError.html","kind":"class","full_name":"CliGen::InternalError","name":"InternalError","abstract":false,"superclass":{"html_id":"CliGenerator/CliGen/Error","kind":"class","full_name":"CliGen::Error","name":"Error"},"ancestors":[{"html_id":"CliGenerator/CliGen/Error","kind":"class","full_name":"CliGen::Error","name":"Error"},{"html_id":"CliGenerator/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"CliGenerator/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"CliGenerator/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cligen/exceptions.cr","line_number":12,"url":null}],"repository_name":"CliGenerator","program":false,"enum":false,"alias":false,"const":false,"subclasses":[{"html_id":"CliGenerator/CliGen/ArgReprocessedError","kind":"class","full_name":"CliGen::ArgReprocessedError","name":"ArgReprocessedError"},{"html_id":"CliGenerator/CliGen/RegexInvariantError","kind":"class","full_name":"CliGen::RegexInvariantError","name":"RegexInvariantError"},{"html_id":"CliGenerator/CliGen/UnknownCommandNodeError","kind":"class","full_name":"CliGen::UnknownCommandNodeError","name":"UnknownCommandNodeError"}],"namespace":{"html_id":"CliGenerator/CliGen","kind":"module","full_name":"CliGen","name":"CliGen"}},{"html_id":"CliGenerator/CliGen/InternalVar","path":"CliGen/InternalVar.html","kind":"annotation","full_name":"CliGen::InternalVar","name":"InternalVar","abstract":false,"locations":[{"filename":"src/cligen/annotations.cr","line_number":5,"url":null}],"repository_name":"CliGenerator","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"CliGenerator/CliGen","kind":"module","full_name":"CliGen","name":"CliGen"}},{"html_id":"CliGenerator/CliGen/InvalidFlagValueError","path":"CliGen/InvalidFlagValueError.html","kind":"class","full_name":"CliGen::InvalidFlagValueError","name":"InvalidFlagValueError","abstract":false,"superclass":{"html_id":"CliGenerator/CliGen/RuntimeError","kind":"class","full_name":"CliGen::RuntimeError","name":"RuntimeError"},"ancestors":[{"html_id":"CliGenerator/CliGen/RuntimeError","kind":"class","full_name":"CliGen::RuntimeError","name":"RuntimeError"},{"html_id":"CliGenerator/CliGen/Error","kind":"class","full_name":"CliGen::Error","name":"Error"},{"html_id":"CliGenerator/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"CliGenerator/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"CliGenerator/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cligen/exceptions.cr","line_number":66,"url":null}],"repository_name":"CliGenerator","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"CliGenerator/CliGen","kind":"module","full_name":"CliGen","name":"CliGen"},"doc":"A provided value doesn't satisfy type or format requirements (wrong type, bad format, invalid bool/date string)","summary":"A provided value doesn't satisfy type or format requirements (wrong type, bad format, invalid bool/date string)
"},{"html_id":"CliGenerator/CliGen/InvalidOptionError","path":"CliGen/InvalidOptionError.html","kind":"class","full_name":"CliGen::InvalidOptionError","name":"InvalidOptionError","abstract":false,"superclass":{"html_id":"CliGenerator/CliGen/RuntimeError","kind":"class","full_name":"CliGen::RuntimeError","name":"RuntimeError"},"ancestors":[{"html_id":"CliGenerator/CliGen/RuntimeError","kind":"class","full_name":"CliGen::RuntimeError","name":"RuntimeError"},{"html_id":"CliGenerator/CliGen/Error","kind":"class","full_name":"CliGen::Error","name":"Error"},{"html_id":"CliGenerator/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"CliGenerator/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"CliGenerator/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cligen/exceptions.cr","line_number":69,"url":null}],"repository_name":"CliGenerator","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"CliGenerator/CliGen","kind":"module","full_name":"CliGen","name":"CliGen"},"doc":"A provided value is not in the flag's allowed options list","summary":"A provided value is not in the flag's allowed options list
"},{"html_id":"CliGenerator/CliGen/MatchType","path":"CliGen/MatchType.html","kind":"enum","full_name":"CliGen::MatchType","name":"MatchType","abstract":false,"ancestors":[{"html_id":"CliGenerator/Enum","kind":"struct","full_name":"Enum","name":"Enum"},{"html_id":"CliGenerator/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"CliGenerator/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"CliGenerator/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cligen/match_type.cr","line_number":5,"url":null}],"repository_name":"CliGenerator","program":false,"enum":true,"alias":false,"const":false,"constants":[{"id":"FlagWithArg","name":"FlagWithArg","value":"0"},{"id":"FlagMultipleShort","name":"FlagMultipleShort","value":"1"},{"id":"ShortWithInlineArg","name":"ShortWithInlineArg","value":"2"},{"id":"SubCommand","name":"SubCommand","value":"3"},{"id":"Help","name":"Help","value":"4"},{"id":"NoMatch","name":"NoMatch","value":"5"}],"namespace":{"html_id":"CliGenerator/CliGen","kind":"module","full_name":"CliGen","name":"CliGen"},"instance_methods":[{"html_id":"flag_multiple_short?-instance-method","name":"flag_multiple_short?","doc":"Returns `true` if this enum value equals `FlagMultipleShort`","summary":"Returns true if this enum value equals FlagMultipleShort
Returns true if this enum value equals FlagWithArg
Returns true if this enum value equals Help
Returns true if this enum value equals NoMatch
Returns true if this enum value equals ShortWithInlineArg
Returns true if this enum value equals SubCommand
A CommandNode(T) has no subcommands and no #main defined
"},{"html_id":"CliGenerator/CliGen/MissingRequiredFlagError","path":"CliGen/MissingRequiredFlagError.html","kind":"class","full_name":"CliGen::MissingRequiredFlagError","name":"MissingRequiredFlagError","abstract":false,"superclass":{"html_id":"CliGenerator/CliGen/RuntimeError","kind":"class","full_name":"CliGen::RuntimeError","name":"RuntimeError"},"ancestors":[{"html_id":"CliGenerator/CliGen/RuntimeError","kind":"class","full_name":"CliGen::RuntimeError","name":"RuntimeError"},{"html_id":"CliGenerator/CliGen/Error","kind":"class","full_name":"CliGen::Error","name":"Error"},{"html_id":"CliGenerator/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"CliGenerator/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"CliGenerator/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cligen/exceptions.cr","line_number":57,"url":null}],"repository_name":"CliGenerator","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"CliGenerator/CliGen","kind":"module","full_name":"CliGen","name":"CliGen"},"doc":"A required flag was not provided and has no env var or default to fall back on","summary":"A required flag was not provided and has no env var or default to fall back on
"},{"html_id":"CliGenerator/CliGen/Parsable","path":"CliGen/Parsable.html","kind":"module","full_name":"CliGen::Parsable","name":"Parsable","abstract":false,"locations":[{"filename":"src/cligen/parsable.cr","line_number":4,"url":null}],"repository_name":"CliGenerator","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"CliGenerator/CliGen","kind":"module","full_name":"CliGen","name":"CliGen"},"instance_methods":[{"html_id":"parse_args(args:Array(CliGen::Arg))-instance-method","name":"parse_args","abstract":true,"args":[{"name":"args","external_name":"args","restriction":"Array(CliGen::Arg)"}],"args_string":"(args : Array(CliGen::Arg))","args_html":"(args : Array(CliGen::Arg))","location":{"filename":"src/cligen/parsable.cr","line_number":5,"url":null},"def":{"name":"parse_args","args":[{"name":"args","external_name":"args","restriction":"Array(CliGen::Arg)"}],"visibility":"Public","body":""},"external_var":false}]},{"html_id":"CliGenerator/CliGen/ParseableInvariantError","path":"CliGen/ParseableInvariantError.html","kind":"class","full_name":"CliGen::ParseableInvariantError","name":"ParseableInvariantError","abstract":false,"superclass":{"html_id":"CliGenerator/CliGen/ConfigurationError","kind":"class","full_name":"CliGen::ConfigurationError","name":"ConfigurationError"},"ancestors":[{"html_id":"CliGenerator/CliGen/ConfigurationError","kind":"class","full_name":"CliGen::ConfigurationError","name":"ConfigurationError"},{"html_id":"CliGenerator/CliGen/Error","kind":"class","full_name":"CliGen::Error","name":"Error"},{"html_id":"CliGenerator/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"CliGenerator/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"CliGenerator/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/cligen/exceptions.cr","line_number":48,"url":null}],"repository_name":"CliGenerator","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"CliGenerator/CliGen","kind":"module","full_name":"CliGen","name":"CliGen"},"doc":"A Parsable type's parse_args did not mark any args as processed","summary":"A Parsable type's parse_args did not mark any args as processed
"},{"html_id":"CliGenerator/CliGen/PreRunCommand","path":"CliGen/PreRunCommand.html","kind":"annotation","full_name":"CliGen::PreRunCommand","name":"PreRunCommand","abstract":false,"locations":[{"filename":"src/cligen/annotations.cr","line_number":211,"url":null}],"repository_name":"CliGenerator","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"CliGenerator/CliGen","kind":"module","full_name":"CliGen","name":"CliGen"}},{"html_id":"CliGenerator/CliGen/ProxyCommand","path":"CliGen/ProxyCommand.html","kind":"annotation","full_name":"CliGen::ProxyCommand","name":"ProxyCommand","abstract":false,"locations":[{"filename":"src/cligen/annotations.cr","line_number":10,"url":null}],"repository_name":"CliGenerator","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"CliGenerator/CliGen","kind":"module","full_name":"CliGen","name":"CliGen"},"doc":"(Not Implemented Yet)\nIn the future you would use this to annotate a \"proxy command\" that will allow you to defer execution\nof a \"subcommand\" to an external method not located in the class itself.","summary":"(Not Implemented Yet) In the future you would use this to annotate a "proxy command" that will allow you to defer execution of a "subcommand" to an external method not located in the class itself.
"},{"html_id":"CliGenerator/CliGen/Regex","path":"CliGen/Regex.html","kind":"module","full_name":"CliGen::Regex","name":"Regex","abstract":false,"locations":[{"filename":"src/cligen/regex.cr","line_number":4,"url":null}],"repository_name":"CliGenerator","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DATE","name":"DATE","value":"/(?--------------------------------------------------------------------------- Date/time matchers - fully anchored so a partial match can't slip through.
"},{"id":"INPUT_DATE_SIMPLE","name":"INPUT_DATE_SIMPLE","value":"/^#{DATE}(\\s+#{TIMEZONE})?$/"},{"id":"INPUT_RELATIVE_OPERATIONS","name":"INPUT_RELATIVE_OPERATIONS","value":"/^(?--------------------------------------------------------------------------- Relative Operation matcher - For use with CliGen::Timeparse::RelativeOperation ---------------------------------------------------------------------------
"},{"id":"TIME","name":"TIME","value":"/(?