1 line
206 KiB
JavaScript
1 line
206 KiB
JavaScript
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":"<h1><a id=\"cli-genmax-command-depth\" class=\"anchor\" href=\"#cli-genmax-command-depth\"> <svg class=\"octicon-link\" aria-hidden=\"true\">\n <use href=\"#octicon-link\"/>\n </svg>\n</a>CliGen::MAX_COMMAND_DEPTH</h1>"},{"id":"VERSION","name":"VERSION","value":"\"0.2.0\""}],"macros":[{"html_id":"add_global_flag(type,*,long,description,env_var=\"\",short=nil,validation=nil,default=nil,on_match=nil,options=nil,format=nil,internal=false)-macro","name":"add_global_flag","doc":"This macro provides a user-friendly way to define a global flag for your \nproject.\n\n## What does this do?\nThis macro is used to help define & check a global flag to be used in the\nall levels of commands.\n\nWhen provided it will parse your values & serialize them into a Flag(T)\nobject & insert it in the CliGen::GLOBAL_FLAGS array after checking if \na flag using it's `--long` is already in use. In the case that that long\nis already used it will raise at runtime and you'll need to choose another \nlong.\n\n## Arguments\n### type: TypeNode\n**Required:** true\n\nThis is the type of the flag (Bool, Int32, String, etc). \n\n\n### long: StringLiteral\n**Required:** true\n\nThis is the long form of the flag that will be matched at the command-line\n\n\n### description: StringLiteral\n**Required:** true\n\nThis is the full length description of the flag that will be presented in the \nhelp text provided to the user.\n\n\n### env_var: StringLiteral\n**Required:** false\n\nThis is an ENV VAR that can be used to set this value without providing an \nargument via the CLI. By default it will (unless explicitly disbled by\npassing `env_var: nil` as an argument to disable the env_var entirely)\nwill parse your long flag and set the ENV VAR to the un \"--\" portion of it\n\n**Warning:** Incompatible ENV VAR formatting\n\nWhen providing ENV VARs manually you cannot provide any whitespace or \"-\"\ncharacters internally to it. As thse are both incompatible with ENV VARs.\n\nIf you provide an ENV VAR with these the framework will raise at\ncompile-time and tell you to change them.\n\n**Note:** Auto Generates ENV VAR from flag long\n\nIf you did not provide a ENV VAR manually (or disable it via setting it to\nnil), the macro will use the long flag to create a ENV VAR that can be \nmatched. In this case if the flag has any internal \"-\" chars they will\nbe replaced with \"_\" so \"--long--flag--name\"/\"--long-flag-name\" -> \n\"LONG_FLAG_NAME\".\n\nWhen you provide a long: with a trailing ARGUMENT (ex: \"--item ITEM\", \n\"--item=ITEM\") the flag will first be split on the whitespace or \"=\"\nprior to being used for the ENV_VAR.\n\n\n### short: StringLiteral\n**Required:** false\n\nThis is the short form of a flag (\"--filename\" -> \"-f\") that can be matched \nduring parsing.\n\n**Note:** Alphabetic characters only\n\nUnlike some other frameworks that might support numeric flags, due to the \nissues around supporting them & being able to discern if these are arguments\n(-1/signed int's) or short flags (\"--one\" -> \"-1\"), I've determined that I \nwill not be supporting numeric flags as this causes a number of \ncomplications/complexities around ARGV parsing.\n\n\n### default: T\n**Required:** ?false?\n\nThis is the default value of the flag (String -> \"abc\", Int32 -> 0, etc) \nthat will be returned if no direct (via parsing CLI args) or indirect\n(by parsing ENV VAR values) arguments are provided.\n\nWhile not technically required, it's advised to always set a default\nwhen creating flags as if you don't and nothing is parsed/provided\nwhen Flag(T)#value! is called it will raise a \nCliGen::MissingRequiredFlagError exception at the call site.\n\n\n### options: ArrayLiteral(T)|Call\n**Required:** false\n\nThis argument sets a static list of accepted arguments to a specific subset \nof values.\n\nEX: Output format\n\n CliGen.add_global_flag(String,\n default: \"ecr\",\n short: \"-f\",\n long: \"--format\",\n description: \"Provide the preferred output format\",\n options: %w[ json yaml ecr ]\n )\n\n\n**Note:** Support for runtime resolution\n\nWhile the primary value of this is static arrays of values, you can also \ndelegate the discovery of values to a global method or helper method in\nyour codebase.\n\nHOWEVER, when doing so ALWAYS ensure that you are providing a full path\nto your method, as the the macro has no way of determining relative paths\nin your modules. While, provided you are doing this in the same context as\nthe method you are running, this shouldn't be an issue, however best \npractices dictate you provide a full path just to be careful.\n\nEX: Delegated resolution\n\n module ABC\n def self.items\n %w[ a b c d e f g taco ]\n end\n end\n\n CliGen.add_global_flag(String,\n default: \"a\",\n short: \"-i\",\n long: \"--item\",\n description: \"Provide an item to print\",\n options: ::ABC.items\n )\n\n\n### format: RegexLiteral\n**Required:** false\n\nThis exists to handle (for String & Custom Data Types) filtering & checking \nthat an argument being provided by a user is being given in a specific \nformat.\n\nThis is something you use when you're only wanting to validate formatting,\nif you plan to do more specific/extensive validation you should use the\nvalidation: field.\n\nEX: Hostname matching\n\n CliGen.add_global_flag(Array(String),\n default: [] of String,\n short: \"-H\",\n long: \"--hostname\",\n description: \"Provide a hostname to do remote work on\",\n format: /^[a-zA-Z]{3}[0-9]+node[0-9]$/\n )\n\n\n### validation: ProcLiteral(T, Bool)\n**Required:** false\n\nHere you can provide a ad-hoc proc for doing validations of a provided \nargument that can't easily be done by providing a static `options:` value.\n\n**Note:** Explicit input & return type requirement\n\nThe explicit input `: T` & return `: Bool` turn types are required as the \nmacros I setup are trying to enforce that both the input & return types \nare explicity to avoid truthy & falsey semantics.\n\nEX: checking int range\n\n CliGen.add_global_flag(Int32,\n short: \"-p\",\n long: \"--port\",\n description: \"Provide a single port to test against\",\n validation: ->(port : Int32) : Bool do\n (UInt16::MIN..UInt16::MAX).includes?(port)\n end\n )\n\n\nEX: file existance check\n\n CliGen.add_global_flag(String,\n short: \"-i\",\n long: \"--filename\",\n description: \"Provide a file that will serve as the input for this program\",\n validation: ->(file : String) : Bool do\n if File.exists?(file)\n true\n else\n STDERR.puts \"ERROR : --filename : Provided file (#{file}) does not exist\"\n false\n end\n end\n )\n\n\n### on_match: ProcLiteral(T, Nil)\n**Required:** false\n\nThis option is where you provide the proc for handling ad-hoc \n\nEX: Configuring the stdlib log level\n\n CliGen.add_global_flag(String,\n long: \"--log-level LEVEL\",\n short: \"-l\",\n description: \"Set the current log level of the stdlib Log library\",\n options: %w[ trace debug notice info warn error fatal ],\n on_match: ->(level : String) do\n ::Log.setup(level: ::Log::Severity.parse(level))\n end\n )\n \nEX: Collecting arguments in a global array\n\n\n module MyModule\n MY_ARRAY = [] of String \n CliGen.add_global_flag(String,\n long: \"--filename FILE\",\n short: \"-i\",\n description: \"Provide a single file to check against (repeatable)\",\n validation: ->(file : String) : Bool do\n if File.exists?(file)\n true\n else\n STDERR.puts \"ERROR : --filename : #{file} does not exist\"\n false\n end\n end,\n on_match: ->(file : String) do\n ::MyModule::MY_ARRAY << file\n end\n ) \n end\n\n\nFor more detailed documentation please visit the wiki in the repo. All topics are covered there in much greater detail than inline documentation here","summary":"<p>This macro provides a user-friendly way to define a global flag for your project.</p>","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 = <span class=\"s\">""</span>, short = <span class=\"n\">nil</span>, validation = <span class=\"n\">nil</span>, default = <span class=\"n\">nil</span>, on_match = <span class=\"n\">nil</span>, options = <span class=\"n\">nil</span>, format = <span class=\"n\">nil</span>, internal = <span class=\"n\">false</span>)","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":"<p>Root entry point.</p>","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":"<p>Convenience entry point; defaults to ARGV</p>","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) = <span class=\"t\">ARGV</span>.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(<a href=\"../CliGen/BaseFlag.html\">BaseFlag</a>), commands : Array(<a href=\"../CliGen/BaseCommandNode.html\">BaseCommandNode</a>), pre_run_commands : Array(<a href=\"../CliGen/RunCommand.html\">RunCommand</a>), post_run_commands : Array(<a href=\"../CliGen/RunCommand.html\">RunCommand</a>))","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(<a href=\"../CliGen/BaseFlag.html\">BaseFlag</a>))","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":"<p>This class serves as a "argument wrapper" to force a fail-fast approach to arg-parsing.</p>","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":"<p>The index of the argument in the array it was in</p>","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":"<p>This serves as a trigger that tells the object that it has been processed</p>","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":"<p>The "flag"/variable that tracks is the Arg has been processed yet</p>","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":"<p>The raw string argument provided from the user</p>","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":"<p>Arg#processed was called a second time on the same Arg</p>"},{"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":"<p>This is used for annotating instance variables for the CliGen framework can know how to create your <code><a href=\"../CliGen/Flag.html\">CliGen::Flag</a>(T)</code> objects</p>"},{"html_id":"CliGenerator/CliGen/BaseCommandNode","path":"CliGen/BaseCommandNode.html","kind":"class","full_name":"CliGen::BaseCommandNode","name":"BaseCommandNode","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/command_node/base.cr","line_number":13,"url":null}],"repository_name":"CliGenerator","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"Log","name":"Log","value":"::Log.for(CliGen::CommandNode)"}],"subclasses":[{"html_id":"CliGenerator/CliGen/CommandNode","kind":"class","full_name":"CliGen::CommandNode(T)","name":"CommandNode"}],"namespace":{"html_id":"CliGenerator/CliGen","kind":"module","full_name":"CliGen","name":"CliGen"},"doc":"Non-generic base that lets the tree hold heterogeneous CommandNode(T) children.\nEverything that doesn't depend on T lives here.","summary":"<p>Non-generic base that lets the tree hold heterogeneous CommandNode(T) children.</p>","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(<a href=\"../CliGen/BaseFlag.html\">BaseFlag</a>), commands : Array(<a href=\"../CliGen/BaseCommandNode.html\">BaseCommandNode</a>), pre_run_commands : Array(<a href=\"../CliGen/RunCommand.html\">RunCommand</a>), post_run_commands : Array(<a href=\"../CliGen/RunCommand.html\">RunCommand</a>), meta : <a href=\"../CliGen/CommandMeta.html\">CommandMeta</a>, parent : <a href=\"../CliGen/BaseCommandNode.html\">BaseCommandNode</a> | Nil = <span class=\"n\">nil</span>, description : String | Nil = <span class=\"n\">nil</span>)","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(<a href=\"../CliGen/BaseFlag.html\">BaseFlag</a>)) : 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 arg <flag>=<arg>\" end\n CliGen::MatchType::FlagWithArg\nwhen CliGen::Regex::FLAG_MULTIPLE_SHORT\n Log.debug do \"CommandNode(#{@name})#find_match(#{arg}) : arg found to match the clumped flag format\" end\n CliGen::MatchType::FlagMultipleShort\nelse\n Log.debug do \"CommandNode(#{@name})#find_match(#{arg}) : Found no obvious match format wise. Checking if arg is a command\" end\n if cmd = @commands.find() do |__arg11| __arg11.name == arg end\n Log.debug do \"CommandNode(#{@name})#find_match(#{arg}) : Looks like the arg matched a defined command\" end\n cmd\n else\n Log.debug do \"CommandNode(#{@name})#find_match(#{arg}) : No match found for arg\" end\n CliGen::MatchType::NoMatch\n end\nend\n"},"external_var":false},{"html_id":"flag?(arg:String):BaseFlag|Nil-instance-method","name":"flag?","abstract":false,"args":[{"name":"arg","external_name":"arg","restriction":"String"}],"args_string":"(arg : String) : BaseFlag | Nil","args_html":"(arg : String) : <a href=\"../CliGen/BaseFlag.html\">BaseFlag</a> | Nil","location":{"filename":"src/cligen/command_node/base.cr","line_number":166,"url":null},"def":{"name":"flag?","args":[{"name":"arg","external_name":"arg","restriction":"String"}],"return_type":"BaseFlag | ::Nil","visibility":"Public","body":"Log.trace do \"CommandNode(#{@name})#flag?(#{arg}) : Entered\" end\ncase arg\nwhen CliGen::Regex::FLAG_REGEX\n get(short: arg) || get(long: arg)\nelse\n nil\nend\n"},"external_var":false},{"html_id":"flags:Array(BaseFlag)-instance-method","name":"flags","abstract":false,"location":{"filename":"src/cligen/command_node/base.cr","line_number":15,"url":null},"def":{"name":"flags","return_type":"Array(BaseFlag)","visibility":"Public","body":"@flags"},"external_var":false},{"html_id":"get(*,long:String):BaseFlag|Nil-instance-method","name":"get","abstract":false,"args":[{"name":"","external_name":"","restriction":""},{"name":"long","external_name":"long","restriction":"String"}],"args_string":"(*, long : String) : BaseFlag | Nil","args_html":"(*, long : String) : <a href=\"../CliGen/BaseFlag.html\">BaseFlag</a> | Nil","location":{"filename":"src/cligen/command_node/base.cr","line_number":102,"url":null},"def":{"name":"get","args":[{"name":"","external_name":"","restriction":""},{"name":"long","external_name":"long","restriction":"String"}],"splat_index":0,"return_type":"BaseFlag | ::Nil","visibility":"Public","body":"Log.trace do \"CommandNode(#{@name})#get(long: #{long}) : entered\" end\n(@flags.find do |f| f.long_key == long end || @commands.find(&.flag?(long)).try(&.get(long: long))) || CliGen::GLOBAL_FLAGS.find() do |__arg7| __arg7.long_key == long end\n"},"external_var":false},{"html_id":"get(*,short:String):BaseFlag|Nil-instance-method","name":"get","abstract":false,"args":[{"name":"","external_name":"","restriction":""},{"name":"short","external_name":"short","restriction":"String"}],"args_string":"(*, short : String) : BaseFlag | Nil","args_html":"(*, short : String) : <a href=\"../CliGen/BaseFlag.html\">BaseFlag</a> | Nil","location":{"filename":"src/cligen/command_node/base.cr","line_number":107,"url":null},"def":{"name":"get","args":[{"name":"","external_name":"","restriction":""},{"name":"short","external_name":"short","restriction":"String"}],"splat_index":0,"return_type":"BaseFlag | ::Nil","visibility":"Public","body":"Log.trace do \"CommandNode(#{@name})#get(short: #{short}) : entered\" end\n(@flags.find do |f| f.short == short end || @commands.find(&.flag?(short)).try(&.get(short: short))) || CliGen::GLOBAL_FLAGS.find() do |__arg10| __arg10.short == short end\n"},"external_var":false},{"html_id":"handle_flag_raises(&):Nil-instance-method","name":"handle_flag_raises","abstract":false,"location":{"filename":"src/cligen/command_node/base.cr","line_number":112,"url":null},"def":{"name":"handle_flag_raises","yields":0,"block_arity":0,"return_type":"Nil","visibility":"Public","body":"begin\n yield\nrescue e : CliGen::RuntimeError\n abort(e.message)\nrescue e : CliGen::HelpRequestedError\n raise(CliGen::HelpRequestedError.new(help))\nend"},"external_var":false},{"html_id":"meta:CommandMeta-instance-method","name":"meta","abstract":false,"location":{"filename":"src/cligen/command_node/base.cr","line_number":18,"url":null},"def":{"name":"meta","return_type":"CommandMeta","visibility":"Public","body":"@meta"},"external_var":false},{"html_id":"name:String-instance-method","name":"name","abstract":false,"location":{"filename":"src/cligen/command_node/base.cr","line_number":14,"url":null},"def":{"name":"name","return_type":"String","visibility":"Public","body":"@name"},"external_var":false},{"html_id":"parent?:BaseCommandNode|Nil-instance-method","name":"parent?","abstract":false,"location":{"filename":"src/cligen/command_node/base.cr","line_number":19,"url":null},"def":{"name":"parent?","return_type":"BaseCommandNode | ::Nil","visibility":"Public","body":"@parent"},"external_var":false},{"html_id":"process(args:Array(String)):Nil-instance-method","name":"process","doc":"Converts String array to Arg array and hands off to the typed process method","summary":"<p>Converts String array to Arg array and hands off to the typed process method</p>","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(<a href=\"../CliGen/Arg.html\">CliGen::Arg</a>)) : 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 : <a href=\"../CliGen/FlagMeta.html\">FlagMeta</a>)","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 = <span class=\"n\">nil</span>, short = <span class=\"n\">nil</span>, validation = <span class=\"n\">nil</span>, on_match = <span class=\"n\">nil</span>, def_setter = <span class=\"n\">false</span>, def_getter = <span class=\"n\">false</span>, options = <span class=\"n\">nil</span>, delimiter = <span class=\"s\">","</span>, format = <span class=\"n\">nil</span>, allow_no_verification = <span class=\"n\">false</span>, env_var = <span class=\"s\">""</span>)","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: '<var> : <type> [= val]')\")\nend %}\n\n \n{% name = variable.var %}\n\n \n{% type = variable.type %}\n\n \n{% if long.nil?\n long = \"--#{name.downcase}\"\nend %}\n\n\n CliGen::Common.check_flag_vars(\n raise_base: \n{{ \"CliGen::Command.argument(#{name})\" }}\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 description: \n{{ description }}\n,\n allow_no_verification: \n{{ allow_no_verification }}\n,\n format: \n{{ format }}\n,\n delimiter: \n{{ delimiter }}\n\n )\n\n \n{% if type.resolve < Array && !options.nil? %}\n @[CliGen::Argument(short: {{ short }}, long: {{ long }}, description: {{ description }}, validation: {{ validation }}, on_match: {{ on_match }}, options: [{{ options }}], delimiter: {{ delimiter }}, format: {{ format }}, env_var: {{ env_var }}, allow_no_verification: {{ allow_no_verification }})]\n {% else %}\n @[CliGen::Argument(short: {{ short }}, long: {{ long }}, description: {{ description }}, validation: {{ validation }}, on_match: {{ on_match }}, options: {{ options }}, delimiter: {{ delimiter }}, format: {{ format }}, env_var: {{ env_var }}, allow_no_verification: {{ allow_no_verification }})]\n {% end %}\n\n @\n{{ variable }}\n\n\n \n{% if def_getter %}\n def {{ variable.var }}\n @{{ name }}\n end\n {% end %}\n\n\n \n{% if def_setter %}\n def {{ variable.var }}= (value : {{ type }})\n {% unless validation.nil? %}\n raise CliGen::ValidationError.new(\"#{@type.name}##{@def.name} : Provided value #{value} failed validation\") unless {{ validation }}.call(value)\n {% end %}\n @{{ name }} = value\n end\n {% end %}\n\n \n"}},{"html_id":"define_command_initializer-macro","name":"define_command_initializer","abstract":false,"location":{"filename":"src/cligen/command/define_command_initializer.cr","line_number":6,"url":null},"def":{"name":"define_command_initializer","visibility":"Public","body":" def initialize(*, handler : CliGen::BaseCommandNode)\n @handler = handler\n\n \n{% verbatim do %}\n Log.debug { \"#{self.class.name}#initialize : Initializing class\" }\n {% for var in @type.instance_vars %}\n Log.debug { \"{{ @type.name }}#initialize : Checking {{ var.name }}\" }\n {% anno = var.annotation(CliGen::Argument) %}\n {% if anno %}\n {% if var.type.union?\n raise(\"ERROR : #{@type.name}#initialize : Argument '#{var.name}' cannot be a nilable type (#{var.type}) — flags always resolve to a concrete value\")\n end %}\n Log.debug { \"{{ @type.name }}#initialize : {{ var.name }} is a CliGen managed ivar. Will attempt to gather from associated CliGen::Flag\" }\n if flg = handler.flags.find{|f| f.var == {{ var.name.stringify }} && f.long == {{ anno[:long] }}}\n Log.debug { \"{{ @type.name }}#initialize : {{ var.name }} : Found Flag(long: #{flg.long}). Calling validate! to make sure data provided (in whatever format) is valid\" }\n flg.validate!\n Log.debug { \"{{ @type.name }}#initialize : {{ var.name }} : Found Flag(long: #{flg.long}). Data was valid seems like (or at least a default was set)\" }\n @{{ var.id }} = flg.as(CliGen::Flag({{ var.type }})).value!\n else\n raise CliGen::FlagNotFoundError.new(\"{{ @type.name }}\\#{{@def.name}} : No flag found for \\\"{{ var.name }}\\\"\")\n end\n {% elsif var.annotation(CliGen::InternalVar) %}\n {% else %}\n Log.debug { \"{{ @type.name }}#initialize : {{ var.name }} is not a CliGen managed ivar. Will initialize to default defined in class\" }\n {% if var.default_value.nil?\n raise(\"ERROR : #{@type.name}#{@def.name} : Instance Variable(#{var.name}) is not handled by CliGen and does not have a default value\")\n end %}\n @{{ var.id }} = {{ var.default_value }}\n {% end %}\n {% end %}\n\n {% if @type.has_method?(:after_initialize) %}\n Log.debug { \"{{ @type.name }}#initialize : Developer defined 'after_initialize' so going to call it\" }\n after_initialize\n {% end %}\n {% end %}\n\n \nend\n \n"}},{"html_id":"define_singleton_init-macro","name":"define_singleton_init","doc":"This macro simply provides a easy singleton initializer for your command\nto allow for you do (if this class isn't the target of a command) to still\nbe able to gather a Command object without having to have it as the target.\n\nThis will setup the default (no args) initializer to gather the handler from\nCliGen::App and then resolve all of the ivar (CliGen managed) to the parsed\nvalues from the associated Flag(T) object that (if the process itself is\nbeing started by CliGen the provided flags will store the value to be \nset here)","summary":"<p>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.</p>","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: <val>) kwarg to set your own \nruntime default if the value itself cannot be ensured by the compiler.\n\nThis is a requirement as this macro MUST always return a value without \nrasing, and the only way to do that is force the user to provide a\ndefault of their choosing.","summary":"<p>This macro is just meant to provide the user an ability to resolve instance var/varibles from parent commands.</p>","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 = <span class=\"n\">nil</span>)","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 = <span class=\"n\">nil</span>, &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: '<var> : <type>' or <var>)\")\nend %}\n\n \n{% unless description\n raise(\"ERROR : CliGen::Command.subcommand : You must provide a description\")\nend %}\n\n \n{% unless description.is_a?(StringLiteral)\n raise(\"ERROR : CliGen::Command.subcommand : Provided description must be a String\")\nend %}\n\n \n{% unless examples.nil? %}\n {% if examples.is_a?(Path)\n examples = examples.resolve\nend %}\n {% unless examples.is_a?(ArrayLiteral)\n raise(\"ERROR : CliGen::Command.subcommand : Provided example must be an Array\")\nend %}\n {% end %}\n\n \n{% unless block\n raise(\"ERROR : CliGen::Command.subcommand : You MUST provide a function body\")\nend %}\n\n\n @[CliGen::SubCommand(description: \n{{ description }}\n, \nexamples: \n{{ examples }}\n)]\n def \n{{ func }}\n\n \n{{ block.body }}\n\n \nend\n \n"}},{"html_id":"validate_command_tree-macro","name":"validate_command_tree","doc":"This macro serves as a compile-time checker of the command-tree to \nvalidate that there is no recursive references of the command-list\nthat would possibly cause a recursive stack-overflow during App.generate\nwhen App begins registering all user defined commands.\n\nHowever, while this does exist, due to the way that the App.generate method\nhandles gathering root commands it makes this edge-case impossible to hit\naside from manually running the \nCommand#register_command([] of CliGen::Command) method.\n\nHowever, with this in place this issue cannot be hit at runtime as this will\nprevent compilation if a recursive/circular command tree exists.\n\nAdditionally, this 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).","summary":"<p>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.</p>","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":"<p>This is used to annotate a CliGen::Command subclass to define the description and other possible information in the future</p>"},{"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(<a href=\"../CliGen/BaseFlag.html\">BaseFlag</a>), commands : Array(<a href=\"../CliGen/BaseCommandNode.html\">BaseCommandNode</a>), pre_run_commands : Array(<a href=\"../CliGen/RunCommand.html\">RunCommand</a>), post_run_commands : Array(<a href=\"../CliGen/RunCommand.html\">RunCommand</a>), parent : <a href=\"../CliGen/BaseCommandNode.html\">BaseCommandNode</a> | Nil = <span class=\"n\">nil</span>, description : String | Nil = <span class=\"n\">nil</span>)","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(<a href=\"../CliGen/Arg.html\">CliGen::Arg</a>)) : 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 arg <flag>=<arg>\" end\n if regex_match = CliGen::Regex::FLAG_WITH_ARG.match(arg.value)\n Log.trace do \"CommandNode(#{@name})#process : Arg(#{arg.value}) flag: #{regex_match[\"flag\"]} & arg: #{regex_match[\"arg\"]}\" end\n case flag_match = find_match(regex_match[\"flag\"])\n when BaseFlag\n Log.debug do \"CommandNode(#{@name})#process : Arg(#{arg.value}) flag: #{regex_match[\"flag\"]} is actually a flag\" end\n handle_flag_raises do\n flag_match.process([CliGen::Arg.new(value: regex_match[\"arg\"], index: arg.index)])\n end\n else\n Log.debug do \"CommandNode(#{@name})#process : Arg(#{arg.value}) flag: #{regex_match[\"flag\"]} had no flag matches\" end\n raise(CliGen::UnknownCommandNodeError.new(\"CommandNode(#{@name}).process : No flag matched '#{regex_match[\"flag\"]}'\"))\n end\n else\n raise(CliGen::RegexInvariantError.new(\"CommandNode(#{@name})#process : FLAG_WITH_ARG matched in find_match but failed on re-match — this is a framework bug\"))\n end\n when MatchType::FlagMultipleShort\n Log.debug do \"CommandNode(#{@name})#process : Arg(#{arg.value}) was found to be an combined short flag\" end\n val = arg.value.lchop('-')\n\n flg : BaseFlag | ::Nil = flag?(\"-#{val[0]}\")\n if flg\n else\n raise(CliGen::UnknownFlagError.new(\"#{CliGen::APPNAME}: unknown flag '-#{val[0]}'\"))\n end\n\n\n if flag?(\"-#{val[1]}\")\n chars = val.chars\n chars.map do |c| \"-#{c}\" end.each_with_index do |flag, index|\n Log.trace do \"CommandNode(#{@name})#process : Arg(#{arg.value}) : char(flag: #{flag}, index: #{index}) being processed\" end\n case match = find_match(flag)\n when BaseFlag\n Log.trace do \"CommandNode(#{@name})#process : Arg(#{arg.value}) : char(flag: #{flag}, index: #{index}) was actually found to be a flag\" end\n\n handle_flag_raises do\n\n if index == (chars.size - 1)\n if match.requires_arg?\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 match.process\n end\n else\n if match.requires_arg?\n raise(CliGen::FlagBundleError.new(\"#{CliGen::APPNAME}: cannot bundle '#{flag}' — it requires an argument\"))\n end\n match.process\n end\n end\n when MatchType::NoMatch\n raise(CliGen::UnknownFlagError.new(\"#{CliGen::APPNAME}: unknown flag '#{flag}'\"))\n end\n end\n elsif flg.requires_arg?\n raise(CliGen::FlagArgumentError.new(\"#{CliGen::APPNAME}: inline flag arguments are not supported — did you mean '-#{val[0]} #{val[1..]}'?\"))\n else\n raise(CliGen::UnknownFlagError.new(\"#{CliGen::APPNAME}: unknown flag '-#{val[1]}'\"))\n end\n when MatchType::NoMatch\n raise(CliGen::HelpRequestedError.new(\"#{CliGen::APPNAME}: unknown token '#{arg.value}'\\n\\n#{help}\"))\n end\nend\n\n@post_run_commands.each(&.call)\n\n{% unless T == Nil %}\n unless passed_execution\n cls = T.new(handler: self.as(CliGen::BaseCommandNode))\n {% for cmd in T.methods.select(&.annotation(CliGen::PreRunCommand)) %}\n cls.{{ cmd.name }}\n {% end %}\n {% subcmds = T.methods.select(&.annotation(CliGen::SubCommand)) %}\n {% if true %}\n case matched_subcommand\n {% for cmd in subcmds %}\n when {{ cmd.name.stringify }}\n cls.{{ cmd.name }}\n {% end %}\n else\n {% if T.has_method?(:main) %}\n cls.main\n {% else %}\n puts \"ERROR : CommandNode(#{@name})#process : No subcommand matched and no #main defined\"\n puts help\n {% end %}\n exit 0\n end\n {% end %}\n end\n {% else %}\n puts help\n exit 0\n {% end %}\n"},"external_var":false},{"html_id":"subcommands:Array(SubCommandInfo)-instance-method","name":"subcommands","abstract":false,"location":{"filename":"src/cligen/command_node.cr","line_number":39,"url":null},"def":{"name":"subcommands","return_type":"Array(SubCommandInfo)","visibility":"Public","body":"{% if true %}\n {% subcmds = T.methods.select(&.annotation(CliGen::SubCommand)) %}\n {% if subcmds.empty? %}\n [] of SubCommandInfo\n {% else %}\n [\n {% for cmd in subcmds %}\n {% anno = cmd.annotation(CliGen::SubCommand) %}\n SubCommandInfo.new(\n name: {{ cmd.name.stringify }},\n description: {{ anno[:description] }},\n examples: {% if anno[:examples] %} {{ anno[:examples] }} {% else %} nil {% end %}\n ),\n {% end %}\n ]\n {% end %}\n {% end %}"},"external_var":false},{"html_id":"verbose?:Bool-instance-method","name":"verbose?","abstract":false,"location":{"filename":"src/cligen/command_node.cr","line_number":59,"url":null},"def":{"name":"verbose?","return_type":"Bool","visibility":"Public","body":"@verbose_flag || (@verbose_flag = get(long: \"--verbose\").not_nil!.as(Flag(Bool)))\n@verbose_flag.not_nil!.value!\n"},"external_var":false}]},{"html_id":"CliGenerator/CliGen/Common","path":"CliGen/Common.html","kind":"module","full_name":"CliGen::Common","name":"Common","abstract":false,"locations":[{"filename":"src/cligen/common/check_flag_vars.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"},"macros":[{"html_id":"check_flag_vars(*,type,long,description,raise_base,short=nil,validation=nil,on_match=nil,options=nil,format=nil,env_var=nil,delimiter=\",\",allow_no_verification=false,internal=false)-macro","name":"check_flag_vars","abstract":false,"args":[{"name":"","external_name":"","restriction":""},{"name":"type","external_name":"type","restriction":""},{"name":"long","external_name":"long","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"raise_base","external_name":"raise_base","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":"options","default_value":"nil","external_name":"options","restriction":""},{"name":"format","default_value":"nil","external_name":"format","restriction":""},{"name":"env_var","default_value":"nil","external_name":"env_var","restriction":""},{"name":"delimiter","default_value":"\",\"","external_name":"delimiter","restriction":""},{"name":"allow_no_verification","default_value":"false","external_name":"allow_no_verification","restriction":""},{"name":"internal","default_value":"false","external_name":"internal","restriction":""}],"args_string":"(*, type, long, description, raise_base, short = nil, validation = nil, on_match = nil, options = nil, format = nil, env_var = nil, delimiter = \",\", allow_no_verification = false, internal = false)","args_html":"(*, type, long, description, raise_base, short = <span class=\"n\">nil</span>, validation = <span class=\"n\">nil</span>, on_match = <span class=\"n\">nil</span>, options = <span class=\"n\">nil</span>, format = <span class=\"n\">nil</span>, env_var = <span class=\"n\">nil</span>, delimiter = <span class=\"s\">","</span>, allow_no_verification = <span class=\"n\">false</span>, internal = <span class=\"n\">false</span>)","location":{"filename":"src/cligen/common/check_flag_vars.cr","line_number":5,"url":null},"def":{"name":"check_flag_vars","args":[{"name":"","external_name":"","restriction":""},{"name":"type","external_name":"type","restriction":""},{"name":"long","external_name":"long","restriction":""},{"name":"description","external_name":"description","restriction":""},{"name":"raise_base","external_name":"raise_base","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":"options","default_value":"nil","external_name":"options","restriction":""},{"name":"format","default_value":"nil","external_name":"format","restriction":""},{"name":"env_var","default_value":"nil","external_name":"env_var","restriction":""},{"name":"delimiter","default_value":"\",\"","external_name":"delimiter","restriction":""},{"name":"allow_no_verification","default_value":"false","external_name":"allow_no_verification","restriction":""},{"name":"internal","default_value":"false","external_name":"internal","restriction":""}],"splat_index":0,"visibility":"Public","body":" \n{% raise_base = raise_base.id %}\n\n \n{% unless type.resolve.is_a?(TypeNode)\n raise(\"ERROR : #{raise_base} : Provided type (#{type}) must resolve to a type\")\nend %}\n\n \n{% unless env_var.nil? || (env_var == \"\") %}\n {% unless env_var.is_a?(StringLiteral)\n raise(\"ERROR : #{raise_base} : Provided env_var must be a string\")\nend %}\n {% if env_var.includes?(\"-\")\n raise(\"ERROR : #{raise_base} : Provided env_var cannot contain a \\\"-\\\". Please fix and re-run\")\nend %}\n {% end %}\n\n \n{% unless delimiter.is_a?(StringLiteral)\n raise(\"ERROR : #{raise_base} : Provided delimiter must be a string\")\nend %}\n\n \n{% unless short.nil? %}\n {% unless short.is_a?(StringLiteral)\n raise(\"ERROR : #{raise_base} : Provided short must be a string\")\nend %}\n {% unless short =~ ::CliGen::Regex::FLAG_SHORT\n raise(\"ERROR : #{raise_base} : Provided short(#{short}) must be in a valid short format #{::CliGen::Regex::FLAG_SHORT}\")\nend %}\n {% unless internal %}\n {% if ([\"-h\", \"-v\"] of ::String).includes?(short) %}\n {% raise(\"ERROR : #{raise_base} : Short(#{short}) is a reserved for internal usage. Please choose another short\") %}\n {% end %}\n {% end %}\n {% end %}\n\n \n{% unless long.is_a?(StringLiteral)\n raise(\"ERROR : #{raise_base} : Provided long must be a string\")\nend %}\n\n \n{% if long =~ (/\\s+|=+/) %}\n {% long = (long.split(/\\s+|=+/)).first %}\n {% end %}\n\n \n{% unless long =~ ::CliGen::Regex::FLAG_LONG\n raise(\"ERROR : #{raise_base} : Provided long (#{long}) must match #{::CliGen::Regex::FLAG_LONG.source}\")\nend %}\n\n \n{% unless internal %}\n {% if ([\"--help\", \"--verbose\"] of ::String).includes?(long) %}\n {% raise(\"ERROR : #{raise_base} : Long(#{long}) is a reserved for internal usage. Please choose another long\") %}\n {% end %}\n {% end %}\n\n \n{% unless description\n raise(\"ERROR : #{raise_base} : You must provide a description\")\nend %}\n\n \n{% unless description.is_a?(StringLiteral) || description.is_a?(StringInterpolation)\n raise(\"ERROR : #{raise_base} : Provided description must be a String\")\nend %}\n\n \n{% unless on_match.nil? %}\n {% unless on_match.is_a?(ProcLiteral)\n raise(\"ERROR : #{raise_base} : Provided on_match must be a Proc\")\nend %}\n {% if on_match.args.empty?\n raise(\"ERROR : #{raise_base} : You must have arguments for on_match\")\nend %}\n {% unless on_match.args.first.restriction\n raise(\"ERROR : #{raise_base} : Your input argument must have a type\")\nend %}\n {% unless on_match.args.first.restriction == type\n raise(\"ERROR : #{raise_base} : Your input argument must be the same type as your argument (#{type})\")\nend %}\n {% end %}\n\n \n{% unless validation.nil? %}\n {% unless validation.is_a?(ProcLiteral)\n raise(\"ERROR : #{raise_base} : Provided validation must be a Proc\")\nend %}\n {% unless validation.return_type.resolve == Bool\n raise(\"ERROR : #{raise_base} : Provided validation return type must be a Bool\")\nend %}\n {% if validation.args.empty?\n raise(\"ERROR : #{raise_base} : Provided validation provided validation must have an input variable\")\nend %}\n {% unless validation.args.size == 1\n raise(\"ERROR : #{raise_base} : Provided validation provided validation must have a single argument\")\nend %}\n {% arg = validation.args.first %}\n {% unless arg.restriction == type %}\n {% example = \"->(#{arg.name} : #{type}) : Bool { #{validation.body} }\" %}\n {% raise(\"ERROR : #{raise_base} : Provided validation input value must be #{type}. EX: #{example}\") %}\n {% end %}\n {% end %}\n\n \n{% if options %}\n {% if options.is_a?(Path)\n options = options.resolve\nend %}\n {% if options.is_a?(Call) %}\n {% elsif options.is_a?(ArrayLiteral) %}\n {% else %}\n {% raise(\"ERROR : #{raise_base} : Provided options must be an ArrayLiteral or a runtime method call to retrieve data\") %}\n {% end %}\n {% end %}\n\n \n{% if format %}\n {% if format.is_a?(Path)\n format = format.resolve\nend %}\n {% unless format.is_a?(RegexLiteral)\n raise(\"ERROR : #{raise_base} : Provided format must be a RegexLiteral\")\nend %}\n {% end %}\n\n \n{% if type.resolve <= Array && (!allow_no_verification) %}\n {% elem = type.resolve.type_vars.first %}\n {% unless elem < Int || elem < Float %}\n {% if format.nil? && options.nil? %}\n {% raise(\"ERROR : #{raise_base} : When providing custom data types for Array(T) or using Array(String) you must provide a format or options for argument filtering so that parsing can be done deterministically\") %}\n {% end %}\n {% end %}\n {% end %}\n\n \n"}}]},{"html_id":"CliGenerator/CliGen/ConfigurationError","path":"CliGen/ConfigurationError.html","kind":"class","full_name":"CliGen::ConfigurationError","name":"ConfigurationError","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":27,"url":null}],"repository_name":"CliGenerator","program":false,"enum":false,"alias":false,"const":false,"subclasses":[{"html_id":"CliGenerator/CliGen/DuplicateCommandError","kind":"class","full_name":"CliGen::DuplicateCommandError","name":"DuplicateCommandError"},{"html_id":"CliGenerator/CliGen/DuplicateFlagError","kind":"class","full_name":"CliGen::DuplicateFlagError","name":"DuplicateFlagError"},{"html_id":"CliGenerator/CliGen/FlagMissingArgumentError","kind":"class","full_name":"CliGen::FlagMissingArgumentError","name":"FlagMissingArgumentError"},{"html_id":"CliGenerator/CliGen/FlagNotFoundError","kind":"class","full_name":"CliGen::FlagNotFoundError","name":"FlagNotFoundError"},{"html_id":"CliGenerator/CliGen/MissingDispatchError","kind":"class","full_name":"CliGen::MissingDispatchError","name":"MissingDispatchError"},{"html_id":"CliGenerator/CliGen/ParseableInvariantError","kind":"class","full_name":"CliGen::ParseableInvariantError","name":"ParseableInvariantError"},{"html_id":"CliGenerator/CliGen/ReservedFlagError","kind":"class","full_name":"CliGen::ReservedFlagError","name":"ReservedFlagError"}],"namespace":{"html_id":"CliGenerator/CliGen","kind":"module","full_name":"CliGen","name":"CliGen"}},{"html_id":"CliGenerator/CliGen/DuplicateCommandError","path":"CliGen/DuplicateCommandError.html","kind":"class","full_name":"CliGen::DuplicateCommandError","name":"DuplicateCommandError","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":36,"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 command names detected during check!","summary":"<p>Duplicate command names detected during check!</p>"},{"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":"<p>Duplicate short or long flags detected during check!</p>"},{"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":"<p>Base for all CliGen exceptions</p>"},{"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 = <span class=\"s\">","</span>, default : T | Nil = <span class=\"n\">nil</span>, options : Array(T) | Nil = <span class=\"n\">nil</span>, validate : T -> Bool | Nil = <span class=\"n\">nil</span>, on_match : Proc(T, Nil) | Nil = <span class=\"n\">nil</span>, format : ::Regex | Nil = <span class=\"n\">nil</span>)","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(<a href=\"../CliGen/Arg.html\">Arg</a>) = <span class=\"o\">[]</span> <span class=\"k\">of</span> <span class=\"t\">Arg</span>) : 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 = <span class=\"n\">nil</span>) : 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":"<p>A flag token was provided where a value argument was expected</p>"},{"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":"<p>A flag that requires an argument was included in a short-flag bundle</p>"},{"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":"<p>To be able to store metadata for use in the help output</p>","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":"<p>A flag that requires an argument was processed with an empty argv</p>"},{"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":"<p>No flag was found in the handler for a Command ivar during initialize</p>"},{"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":"<p>This module just holds time formats to be used with ::Time.parse!/.parse/.parse_local</p>"},{"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":"<p>Raised when -h/--help is matched; carries the rendered help string</p>"},{"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":"<p>A provided value doesn't satisfy type or format requirements (wrong type, bad format, invalid bool/date string)</p>"},{"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":"<p>A provided value is not in the flag's allowed options list</p>"},{"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":"<p>Returns <code>true</code> if this enum value equals <code><a href=\"../CliGen/MatchType.html#FlagMultipleShort\">FlagMultipleShort</a></code></p>","abstract":false,"location":{"filename":"src/cligen/match_type.cr","line_number":7,"url":null},"def":{"name":"flag_multiple_short?","visibility":"Public","body":"self == FlagMultipleShort"},"external_var":false},{"html_id":"flag_with_arg?-instance-method","name":"flag_with_arg?","doc":"Returns `true` if this enum value equals `FlagWithArg`","summary":"<p>Returns <code>true</code> if this enum value equals <code><a href=\"../CliGen/MatchType.html#FlagWithArg\">FlagWithArg</a></code></p>","abstract":false,"location":{"filename":"src/cligen/match_type.cr","line_number":6,"url":null},"def":{"name":"flag_with_arg?","visibility":"Public","body":"self == FlagWithArg"},"external_var":false},{"html_id":"help?-instance-method","name":"help?","doc":"Returns `true` if this enum value equals `Help`","summary":"<p>Returns <code>true</code> if this enum value equals <code><a href=\"../CliGen/MatchType.html#Help\">Help</a></code></p>","abstract":false,"location":{"filename":"src/cligen/match_type.cr","line_number":10,"url":null},"def":{"name":"help?","visibility":"Public","body":"self == Help"},"external_var":false},{"html_id":"no_match?-instance-method","name":"no_match?","doc":"Returns `true` if this enum value equals `NoMatch`","summary":"<p>Returns <code>true</code> if this enum value equals <code><a href=\"../CliGen/MatchType.html#NoMatch\">NoMatch</a></code></p>","abstract":false,"location":{"filename":"src/cligen/match_type.cr","line_number":11,"url":null},"def":{"name":"no_match?","visibility":"Public","body":"self == NoMatch"},"external_var":false},{"html_id":"short_with_inline_arg?-instance-method","name":"short_with_inline_arg?","doc":"Returns `true` if this enum value equals `ShortWithInlineArg`","summary":"<p>Returns <code>true</code> if this enum value equals <code><a href=\"../CliGen/MatchType.html#ShortWithInlineArg\">ShortWithInlineArg</a></code></p>","abstract":false,"location":{"filename":"src/cligen/match_type.cr","line_number":8,"url":null},"def":{"name":"short_with_inline_arg?","visibility":"Public","body":"self == ShortWithInlineArg"},"external_var":false},{"html_id":"sub_command?-instance-method","name":"sub_command?","doc":"Returns `true` if this enum value equals `SubCommand`","summary":"<p>Returns <code>true</code> if this enum value equals <code><a href=\"../CliGen/MatchType.html#SubCommand\">SubCommand</a></code></p>","abstract":false,"location":{"filename":"src/cligen/match_type.cr","line_number":9,"url":null},"def":{"name":"sub_command?","visibility":"Public","body":"self == SubCommand"},"external_var":false}]},{"html_id":"CliGenerator/CliGen/MissingDispatchError","path":"CliGen/MissingDispatchError.html","kind":"class","full_name":"CliGen::MissingDispatchError","name":"MissingDispatchError","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":39,"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 CommandNode(T) has no subcommands and no #main defined","summary":"<p>A CommandNode(T) has no subcommands and no #main defined</p>"},{"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":"<p>A required flag was not provided and has no env var or default to fall back on</p>"},{"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(<a href=\"../CliGen/Arg.html\">CliGen::Arg</a>))","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":"<p>A Parsable type's parse_args did not mark any args as processed</p>"},{"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":"<p>(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.</p>"},{"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>(?<year>[0-9]{4})-(?<month>[0-9]{2})-(?<day>[0-9]{2}))/"},{"id":"EPOCH","name":"EPOCH","value":"/@(?<epoch>[0-9]+)/"},{"id":"FLAG_LONG","name":"FLAG_LONG","value":"/^--[a-zA-Z0-9][a-zA-Z0-9-_]+$/"},{"id":"FLAG_MULTIPLE_SHORT","name":"FLAG_MULTIPLE_SHORT","value":"/^-[a-zA-Z][a-zA-Z]+$/"},{"id":"FLAG_REGEX","name":"FLAG_REGEX","value":"/^(-[a-zA-Z]|--[a-zA-Z-_0-9]+)$/"},{"id":"FLAG_SHORT","name":"FLAG_SHORT","value":"/^-[a-zA-Z]$/"},{"id":"FLAG_WITH_ARG","name":"FLAG_WITH_ARG","value":"/^(?<flag>(-[a-zA-Z]|--[a-zA-Z0-9][a-zA-Z0-9-_]+))=\"?(?<arg>.+?)\"?$/"},{"id":"FLOAT","name":"FLOAT","value":"/^[-+]?[[:digit:]]+(\\.[[:digit:]]+)?$/"},{"id":"INPUT_DATE_EPOCH","name":"INPUT_DATE_EPOCH","value":"/^#{EPOCH}(\\s+#{TIMEZONE})?$/"},{"id":"INPUT_DATE_FULL","name":"INPUT_DATE_FULL","value":"/^#{DATE}\\s+#{TIME}(\\s+#{TIMEZONE})?$/","doc":"---------------------------------------------------------------------------\nDate/time matchers - fully anchored so a partial match can't slip through.\n---------------------------------------------------------------------------","summary":"<p>--------------------------------------------------------------------------- Date/time matchers - fully anchored so a partial match can't slip through.</p>"},{"id":"INPUT_DATE_SIMPLE","name":"INPUT_DATE_SIMPLE","value":"/^#{DATE}(\\s+#{TIMEZONE})?$/"},{"id":"INPUT_RELATIVE_OPERATIONS","name":"INPUT_RELATIVE_OPERATIONS","value":"/^(?<operations>(#{RELATIVE}\\s*)+)(\\s+#{TIMEZONE})?$/"},{"id":"INT","name":"INT","value":"/^[-+]?[[:digit:]]+$/"},{"id":"RELATIVE","name":"RELATIVE","value":"/[+-][0-9]+\\s+(seconds?|minutes?|hours?|days?|weeks?|months?|years?)/"},{"id":"RELATIVE_OPERATION","name":"RELATIVE_OPERATION","value":"/(?<sign>[+-])(?<quantity>[0-9]+)\\s+(?<unit>seconds?|minutes?|hours?|days?|weeks?|months?|years?)/","doc":"---------------------------------------------------------------------------\nRelative Operation matcher - For use with CliGen::Timeparse::RelativeOperation\n---------------------------------------------------------------------------","summary":"<p>--------------------------------------------------------------------------- Relative Operation matcher - For use with CliGen::Timeparse::RelativeOperation ---------------------------------------------------------------------------</p>"},{"id":"TIME","name":"TIME","value":"/(?<time>(?<hour>[0-9]{2}):(?<minute>[0-9]{2}):(?<second>[0-9]{2}))/"},{"id":"TIMEZONE","name":"TIMEZONE","value":"/(?<timezone>(?<offset_sign>[-+])(?<offset_hour>[01][0-9]|2[0-3])(?<offset_minute>[0-5][0-9]))/","doc":"---------------------------------------------------------------------------\nDate/time components.\n\nThese are building blocks ONLY — they are interpolated into the anchored\nmatchers below and must stay unanchored. Interpolating a Regex renders it\nas `(?-imsx:...)`, so an anchor here would end up buried mid-pattern in the\ncomposites (`^(?-imsx:^...$)\\s+...$`) and could never match.\n\nNever match user input against these directly — use the INPUT_DATE_*\nmatchers, which are anchored.\n---------------------------------------------------------------------------\nHour is bounded 00-23 and minute 00-59 so the largest representable offset\nis 23:59 (86340s), which stays inside Time::Location.fixed's +/-24h limit.\nWithout these bounds an offset like -9999 passes the match and then raises\nTime::Location::InvalidTimezoneOffsetError - a non-CliGen exception that\nescapes App#handle_command_raises and reaches the user as a stack trace.","summary":"<p>--------------------------------------------------------------------------- Date/time components.</p>"},{"id":"UINT","name":"UINT","value":"/^[[:digit:]]+$/"}],"namespace":{"html_id":"CliGenerator/CliGen","kind":"module","full_name":"CliGen","name":"CliGen"}},{"html_id":"CliGenerator/CliGen/RegexInvariantError","path":"CliGen/RegexInvariantError.html","kind":"class","full_name":"CliGen::RegexInvariantError","name":"RegexInvariantError","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":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":"A token matched FLAG_WITH_ARG in find_match but the regex failed on re-match","summary":"<p>A token matched FLAG_WITH_ARG in find_match but the regex failed on re-match</p>"},{"html_id":"CliGenerator/CliGen/ReservedFlagError","path":"CliGen/ReservedFlagError.html","kind":"class","full_name":"CliGen::ReservedFlagError","name":"ReservedFlagError","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":30,"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":"-h or --help was used as a flag short/long (reserved for internal help)","summary":"<p>-h or --help was used as a flag short/long (reserved for internal help)</p>"},{"html_id":"CliGenerator/CliGen/RunCommand","path":"CliGen/RunCommand.html","kind":"alias","full_name":"CliGen::RunCommand","name":"RunCommand","abstract":false,"locations":[{"filename":"src/cligen/command_node/base.cr","line_number":9,"url":null}],"repository_name":"CliGenerator","program":false,"enum":false,"alias":true,"aliased":"Proc(Nil)","aliased_html":" -> Nil","const":false,"namespace":{"html_id":"CliGenerator/CliGen","kind":"module","full_name":"CliGen","name":"CliGen"}},{"html_id":"CliGenerator/CliGen/RuntimeError","path":"CliGen/RuntimeError.html","kind":"class","full_name":"CliGen::RuntimeError","name":"RuntimeError","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":54,"url":null}],"repository_name":"CliGenerator","program":false,"enum":false,"alias":false,"const":false,"subclasses":[{"html_id":"CliGenerator/CliGen/FlagArgumentError","kind":"class","full_name":"CliGen::FlagArgumentError","name":"FlagArgumentError"},{"html_id":"CliGenerator/CliGen/FlagBundleError","kind":"class","full_name":"CliGen::FlagBundleError","name":"FlagBundleError"},{"html_id":"CliGenerator/CliGen/InvalidFlagValueError","kind":"class","full_name":"CliGen::InvalidFlagValueError","name":"InvalidFlagValueError"},{"html_id":"CliGenerator/CliGen/InvalidOptionError","kind":"class","full_name":"CliGen::InvalidOptionError","name":"InvalidOptionError"},{"html_id":"CliGenerator/CliGen/MissingRequiredFlagError","kind":"class","full_name":"CliGen::MissingRequiredFlagError","name":"MissingRequiredFlagError"},{"html_id":"CliGenerator/CliGen/TimeParseError","kind":"class","full_name":"CliGen::TimeParseError","name":"TimeParseError"},{"html_id":"CliGenerator/CliGen/UnknownFlagError","kind":"class","full_name":"CliGen::UnknownFlagError","name":"UnknownFlagError"},{"html_id":"CliGenerator/CliGen/ValidationError","kind":"class","full_name":"CliGen::ValidationError","name":"ValidationError"}],"namespace":{"html_id":"CliGenerator/CliGen","kind":"module","full_name":"CliGen","name":"CliGen"}},{"html_id":"CliGenerator/CliGen/SubCommand","path":"CliGen/SubCommand.html","kind":"annotation","full_name":"CliGen::SubCommand","name":"SubCommand","abstract":false,"locations":[{"filename":"src/cligen/annotations.cr","line_number":214,"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/SubCommandInfo","path":"CliGen/SubCommandInfo.html","kind":"struct","full_name":"CliGen::SubCommandInfo","name":"SubCommandInfo","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/subcommand_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(name:String,description:String,examples:Array(String)|Nil)-class-method","name":"new","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"String"},{"name":"description","external_name":"description","restriction":"String"},{"name":"examples","external_name":"examples","restriction":"Array(String) | ::Nil"}],"args_string":"(name : String, description : String, examples : Array(String) | Nil)","args_html":"(name : String, description : String, examples : Array(String) | Nil)","location":{"filename":"src/cligen/command_node/subcommand_meta.cr","line_number":5,"url":null},"def":{"name":"new","args":[{"name":"name","external_name":"name","restriction":"String"},{"name":"description","external_name":"description","restriction":"String"},{"name":"examples","external_name":"examples","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"_ = allocate\n_.initialize(name, description, examples)\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/subcommand_meta.cr","line_number":5,"url":null},"def":{"name":"clone","visibility":"Public","body":"self.class.new(@name.clone, @description.clone, @examples.clone)"},"external_var":false},{"html_id":"copy_with(name_name=@name,description_description=@description,examples_examples=@examples)-instance-method","name":"copy_with","abstract":false,"args":[{"name":"_name","default_value":"@name","external_name":"name","restriction":""},{"name":"_description","default_value":"@description","external_name":"description","restriction":""},{"name":"_examples","default_value":"@examples","external_name":"examples","restriction":""}],"args_string":"(name _name = @name, description _description = @description, examples _examples = @examples)","args_html":"(name _name = @name, description _description = @description, examples _examples = @examples)","location":{"filename":"src/cligen/command_node/subcommand_meta.cr","line_number":5,"url":null},"def":{"name":"copy_with","args":[{"name":"_name","default_value":"@name","external_name":"name","restriction":""},{"name":"_description","default_value":"@description","external_name":"description","restriction":""},{"name":"_examples","default_value":"@examples","external_name":"examples","restriction":""}],"visibility":"Public","body":"self.class.new(_name, _description, _examples)"},"external_var":false},{"html_id":"description:String-instance-method","name":"description","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"},"external_var":false},{"html_id":"examples:Array(String)|Nil-instance-method","name":"examples","abstract":false,"def":{"name":"examples","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@examples"},"external_var":false},{"html_id":"name:String-instance-method","name":"name","abstract":false,"def":{"name":"name","return_type":"String","visibility":"Public","body":"@name"},"external_var":false}]},{"html_id":"CliGenerator/CliGen/Timeparse","path":"CliGen/Timeparse.html","kind":"module","full_name":"CliGen::Timeparse","name":"Timeparse","abstract":false,"locations":[{"filename":"src/cligen/timeparse.cr","line_number":7,"url":null},{"filename":"src/cligen/timeparse/operation_unit.cr","line_number":4,"url":null},{"filename":"src/cligen/timeparse/relative_operation.cr","line_number":9,"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"},"class_methods":[{"html_id":"parse(raw:String):Time-class-method","name":"parse","abstract":false,"args":[{"name":"raw","external_name":"raw","restriction":"String"}],"args_string":"(raw : String) : Time","args_html":"(raw : String) : Time","location":{"filename":"src/cligen/timeparse.cr","line_number":17,"url":null},"def":{"name":"parse","args":[{"name":"raw","external_name":"raw","restriction":"String"}],"return_type":"Time","visibility":"Public","body":"begin\n raw = raw.strip\n case raw\n when CliGen::Regex::INPUT_DATE_EPOCH\n match = raw.match!(CliGen::Regex::INPUT_DATE_EPOCH)\n if match[\"timezone\"]?\n (::Time.unix(match[\"epoch\"].to_i)).in(get_location(match[\"timezone\"]))\n else\n ::Time.parse!(raw, CliGen::Format::INPUT_EPOCH)\n end\n when CliGen::Regex::INPUT_DATE_FULL\n match = raw.match!(CliGen::Regex::INPUT_DATE_FULL)\n if match[\"timezone\"]?\n ::Time.parse!(raw, CliGen::Format::INPUT_DATE_FULL)\n else\n ::Time.parse_local(raw, CliGen::Format::INPUT_DATE_PARTIAL)\n end\n when CliGen::Regex::INPUT_DATE_SIMPLE\n match = raw.match!(CliGen::Regex::INPUT_DATE_SIMPLE)\n if match[\"timezone\"]?\n ::Time.parse!(raw, CliGen::Format::INPUT_DATE_SIMPLE_WITH_TIMEZONE)\n else\n ::Time.parse_local(raw, CliGen::Format::INPUT_DATE_SIMPLE)\n end\n when CliGen::Regex::INPUT_RELATIVE_OPERATIONS\n match = raw.match!(CliGen::Regex::INPUT_RELATIVE_OPERATIONS)\n ops = RelativeOperation.get_operations(match[\"operations\"])\n time = ::Time.local\n\n if match[\"timezone\"]?\n time = time.in(get_location(match[\"timezone\"]))\n end\n\n ops.each do |op|\n time = op.apply(time)\n end\n\n time\n else\n raise(CliGen::TimeParseError.new(\"ERROR : invalid date/time format \\\"#{raw}\\\". \\n\\nValid are:\\n1) %Y-%m-%d %H:%M:%S %z\\n2) %Y-%m-%d %H:%M:%S\\n3) %Y-%m-%d %z\\n4) %Y-%m-%d\\n5) %s %z\\n6) %s\\n7) ([+-][0-9]+ (years|months|weeks|days|hours|minutes|seconds))+ %z\\n8) ([+-][0-9]+ [years|months|weeks|days|hours|minutes|seconds])+\\n\\nNote on format: \\n # Timezone Offset (ex: -0500 == CST)\\n %z == [-+]([0-1][0-9]|2[0-3])[0-5][0-9]\\n # Year (ex: 2026)\\n %Y == [0-9]{4}\\n # month\\n %m == [0-9]{2}\\n # day\\n %d == [0-9]{2}\\n # hour\\n %H == [0-9]{2}\\n # minute\\n %S == [0-9]{2}\\n # epoch time\\n %s == @[0-9]+\\n\\n\"))\n end\nrescue e : CliGen::Error\n raise(e)\nrescue e : Exception\n raise(CliGen::TimeParseError.new(\"invalid date/time \\\"#{raw}\\\" : #{e.message}\"))\nend"},"external_var":false}],"types":[{"html_id":"CliGenerator/CliGen/Timeparse/OperationUnit","path":"CliGen/Timeparse/OperationUnit.html","kind":"enum","full_name":"CliGen::Timeparse::OperationUnit","name":"OperationUnit","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/timeparse/operation_unit.cr","line_number":5,"url":null}],"repository_name":"CliGenerator","program":false,"enum":true,"alias":false,"const":false,"constants":[{"id":"YEAR","name":"YEAR","value":"0"},{"id":"MONTH","name":"MONTH","value":"1"},{"id":"WEEK","name":"WEEK","value":"2"},{"id":"DAY","name":"DAY","value":"3"},{"id":"HOUR","name":"HOUR","value":"4"},{"id":"MINUTE","name":"MINUTE","value":"5"},{"id":"SECOND","name":"SECOND","value":"6"}],"namespace":{"html_id":"CliGenerator/CliGen/Timeparse","kind":"module","full_name":"CliGen::Timeparse","name":"Timeparse"},"instance_methods":[{"html_id":"day?-instance-method","name":"day?","doc":"Returns `true` if this enum value equals `DAY`","summary":"<p>Returns <code>true</code> if this enum value equals <code><a href=\"../../CliGen/Timeparse/OperationUnit.html#DAY\">DAY</a></code></p>","abstract":false,"location":{"filename":"src/cligen/timeparse/operation_unit.cr","line_number":9,"url":null},"def":{"name":"day?","visibility":"Public","body":"self == DAY"},"external_var":false},{"html_id":"hour?-instance-method","name":"hour?","doc":"Returns `true` if this enum value equals `HOUR`","summary":"<p>Returns <code>true</code> if this enum value equals <code><a href=\"../../CliGen/Timeparse/OperationUnit.html#HOUR\">HOUR</a></code></p>","abstract":false,"location":{"filename":"src/cligen/timeparse/operation_unit.cr","line_number":10,"url":null},"def":{"name":"hour?","visibility":"Public","body":"self == HOUR"},"external_var":false},{"html_id":"minute?-instance-method","name":"minute?","doc":"Returns `true` if this enum value equals `MINUTE`","summary":"<p>Returns <code>true</code> if this enum value equals <code><a href=\"../../CliGen/Timeparse/OperationUnit.html#MINUTE\">MINUTE</a></code></p>","abstract":false,"location":{"filename":"src/cligen/timeparse/operation_unit.cr","line_number":11,"url":null},"def":{"name":"minute?","visibility":"Public","body":"self == MINUTE"},"external_var":false},{"html_id":"month?-instance-method","name":"month?","doc":"Returns `true` if this enum value equals `MONTH`","summary":"<p>Returns <code>true</code> if this enum value equals <code><a href=\"../../CliGen/Timeparse/OperationUnit.html#MONTH\">MONTH</a></code></p>","abstract":false,"location":{"filename":"src/cligen/timeparse/operation_unit.cr","line_number":7,"url":null},"def":{"name":"month?","visibility":"Public","body":"self == MONTH"},"external_var":false},{"html_id":"second?-instance-method","name":"second?","doc":"Returns `true` if this enum value equals `SECOND`","summary":"<p>Returns <code>true</code> if this enum value equals <code><a href=\"../../CliGen/Timeparse/OperationUnit.html#SECOND\">SECOND</a></code></p>","abstract":false,"location":{"filename":"src/cligen/timeparse/operation_unit.cr","line_number":12,"url":null},"def":{"name":"second?","visibility":"Public","body":"self == SECOND"},"external_var":false},{"html_id":"week?-instance-method","name":"week?","doc":"Returns `true` if this enum value equals `WEEK`","summary":"<p>Returns <code>true</code> if this enum value equals <code><a href=\"../../CliGen/Timeparse/OperationUnit.html#WEEK\">WEEK</a></code></p>","abstract":false,"location":{"filename":"src/cligen/timeparse/operation_unit.cr","line_number":8,"url":null},"def":{"name":"week?","visibility":"Public","body":"self == WEEK"},"external_var":false},{"html_id":"year?-instance-method","name":"year?","doc":"Returns `true` if this enum value equals `YEAR`","summary":"<p>Returns <code>true</code> if this enum value equals <code><a href=\"../../CliGen/Timeparse/OperationUnit.html#YEAR\">YEAR</a></code></p>","abstract":false,"location":{"filename":"src/cligen/timeparse/operation_unit.cr","line_number":6,"url":null},"def":{"name":"year?","visibility":"Public","body":"self == YEAR"},"external_var":false}]},{"html_id":"CliGenerator/CliGen/Timeparse/RelativeOperation","path":"CliGen/Timeparse/RelativeOperation.html","kind":"struct","full_name":"CliGen::Timeparse::RelativeOperation","name":"RelativeOperation","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/timeparse/relative_operation.cr","line_number":10,"url":null}],"repository_name":"CliGenerator","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"CliGenerator/CliGen/Timeparse","kind":"module","full_name":"CliGen::Timeparse","name":"Timeparse"},"class_methods":[{"html_id":"get_operations(raw:String):Array(RelativeOperation)-class-method","name":"get_operations","doc":"Just handles retrieving the operations from a bare string and returning \nan array of them for use in applying them in a row","summary":"<p>Just handles retrieving the operations from a bare string and returning an array of them for use in applying them in a row</p>","abstract":false,"args":[{"name":"raw","external_name":"raw","restriction":"String"}],"args_string":"(raw : String) : Array(RelativeOperation)","args_html":"(raw : String) : Array(<a href=\"../../CliGen/Timeparse/RelativeOperation.html\">RelativeOperation</a>)","location":{"filename":"src/cligen/timeparse/relative_operation.cr","line_number":31,"url":null},"def":{"name":"get_operations","args":[{"name":"raw","external_name":"raw","restriction":"String"}],"return_type":"Array(RelativeOperation)","visibility":"Public","body":"(raw.scan(CliGen::Regex::RELATIVE_OPERATION)).map do |match| from_regex(match) end"},"external_var":false}],"constructors":[{"html_id":"new(sign:Int32,quantity:Int32,unit:CliGen::Timeparse::OperationUnit)-class-method","name":"new","abstract":false,"args":[{"name":"sign","external_name":"sign","restriction":"::Int32"},{"name":"quantity","external_name":"quantity","restriction":"::Int32"},{"name":"unit","external_name":"unit","restriction":"::CliGen::Timeparse::OperationUnit"}],"args_string":"(sign : Int32, quantity : Int32, unit : CliGen::Timeparse::OperationUnit)","args_html":"(sign : Int32, quantity : Int32, unit : <a href=\"../../CliGen/Timeparse/OperationUnit.html\">CliGen::Timeparse::OperationUnit</a>)","location":{"filename":"src/cligen/timeparse/relative_operation.cr","line_number":15,"url":null},"def":{"name":"new","args":[{"name":"sign","external_name":"sign","restriction":"::Int32"},{"name":"quantity","external_name":"quantity","restriction":"::Int32"},{"name":"unit","external_name":"unit","restriction":"::CliGen::Timeparse::OperationUnit"}],"visibility":"Public","body":"_ = allocate\n_.initialize(sign, quantity, unit)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"},"external_var":false}],"instance_methods":[{"html_id":"apply(time:Time):Time-instance-method","name":"apply","abstract":false,"args":[{"name":"time","external_name":"time","restriction":"Time"}],"args_string":"(time : Time) : Time","args_html":"(time : Time) : Time","location":{"filename":"src/cligen/timeparse/relative_operation.cr","line_number":18,"url":null},"def":{"name":"apply","args":[{"name":"time","external_name":"time","restriction":"Time"}],"return_type":"Time","visibility":"Public","body":"{% if true %}\n case @unit\n {% for unit in CliGen::Timeparse::OperationUnit.constants %}\n in OperationUnit::{{ unit.id }}\n time + (@sign * @quantity).{{ unit.id.downcase }}\n {% end %}\n end\n {% end %}"},"external_var":false},{"html_id":"quantity:Int32-instance-method","name":"quantity","abstract":false,"location":{"filename":"src/cligen/timeparse/relative_operation.cr","line_number":12,"url":null},"def":{"name":"quantity","return_type":"Int32","visibility":"Public","body":"@quantity"},"external_var":false},{"html_id":"sign:Int32-instance-method","name":"sign","abstract":false,"location":{"filename":"src/cligen/timeparse/relative_operation.cr","line_number":11,"url":null},"def":{"name":"sign","return_type":"Int32","visibility":"Public","body":"@sign"},"external_var":false},{"html_id":"unit:CliGen::Timeparse::OperationUnit-instance-method","name":"unit","abstract":false,"location":{"filename":"src/cligen/timeparse/relative_operation.cr","line_number":13,"url":null},"def":{"name":"unit","return_type":"CliGen::Timeparse::OperationUnit","visibility":"Public","body":"@unit"},"external_var":false}]}]},{"html_id":"CliGenerator/CliGen/TimeParseError","path":"CliGen/TimeParseError.html","kind":"class","full_name":"CliGen::TimeParseError","name":"TimeParseError","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":87,"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":"-------------------------------------------------------------------------\nCliGen::Timeparse Errors\n-------------------------------------------------------------------------","summary":"<p>------------------------------------------------------------------------- CliGen::Timeparse Errors -------------------------------------------------------------------------</p>"},{"html_id":"CliGenerator/CliGen/Trigger","path":"CliGen/Trigger.html","kind":"annotation","full_name":"CliGen::Trigger","name":"Trigger","abstract":false,"locations":[{"filename":"src/cligen/annotations.cr","line_number":208,"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/UnknownCommandNodeError","path":"CliGen/UnknownCommandNodeError.html","kind":"class","full_name":"CliGen::UnknownCommandNodeError","name":"UnknownCommandNodeError","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":21,"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 BaseCommandNode was matched but couldn't be cast to any known CommandNode(T)","summary":"<p>A BaseCommandNode was matched but couldn't be cast to any known CommandNode(T)</p>"},{"html_id":"CliGenerator/CliGen/UnknownFlagError","path":"CliGen/UnknownFlagError.html","kind":"class","full_name":"CliGen::UnknownFlagError","name":"UnknownFlagError","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":72,"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":"An unrecognised flag token was encountered during parsing","summary":"<p>An unrecognised flag token was encountered during parsing</p>"},{"html_id":"CliGenerator/CliGen/ValidationError","path":"CliGen/ValidationError.html","kind":"class","full_name":"CliGen::ValidationError","name":"ValidationError","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":60,"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 setter's validation proc rejected the provided value","summary":"<p>A setter's validation proc rejected the provided value</p>"}]}]}}) |