class Opal::CLI::App

Overview

Root CLI application that manages command routing, help, versions, and execution.

Defined in:

opal/cli/app.cr

Constructors

Instance Method Summary

Instance methods inherited from class Opal::CLI::Command

after(&block : Context -> Nil) : self after, alias_name(*names : String) : self alias_name, aliases : Array(String) aliases, aliases=(aliases : Array(String)) aliases=, all_options : Array(Option) all_options, allow_unknown_options(allow : Bool = true) : self allow_unknown_options, allow_unknown_options=(allow_unknown_options : Bool) allow_unknown_options=, allow_unknown_options? : Bool allow_unknown_options?, argument(name : Symbol, description : String = "", required : Bool = false, default : String | Nil = nil, type : Symbol = :string) : self argument, arguments : Array(Argument) arguments, arguments=(arguments : Array(Argument)) arguments=, before(&block : Context -> Nil) : self before, category(cat : String) : self
category : String | Nil
category
, category=(category : String | Nil) category=, command(name : String | Symbol, description : String = "") : Command
command(name : String | Symbol, description : String = "", &block : Command -> Nil) : Command
command
, description(desc : String) : self
description : String
description
, description=(description : String) description=, example(ex : String) : self example, examples : Array(String) examples, examples=(examples : Array(String)) examples=, execute(context : Context) : Int32 execute, find_command(name : String) : Command | Nil find_command, flag(name : Symbol, long : String, short : String | Nil = nil, description : String = "", default : Bool = false, global : Bool = false) : self flag, help_handler : Context | Nil -> String | Nil | Nil help_handler, help_handler=(help_handler : Context | Nil -> String | Nil | Nil) help_handler=, help_text(app_name : String, context : Context | Nil = nil) : String help_text, name : String name, name=(name : String) name=, on_help(&block : Context | Nil -> String | Nil) : self on_help, option(name : Symbol, long : String, short : String | Nil = nil, description : String = "", type : Symbol = :string, default : OptionValue = nil, required : Bool = false, global : Bool = false, choices : Array(String) | Nil = nil, env_var : String | Nil = nil) : self option, options : Array(Option) options, options=(options : Array(Option)) options=, parent : Command | Nil parent, parent=(parent : Command | Nil) parent=, run(&block : Context -> Nil | Int32) : self run, subcommand(name : String | Symbol, description : String = "") : Command
subcommand(name : String | Symbol, description : String = "", &block : Command -> Nil) : Command
subcommand
, subcommands : Hash(String, Command) subcommands, subcommands=(subcommands : Hash(String, Command)) subcommands=

Constructor methods inherited from class Opal::CLI::Command

new(name : String, description : String = "") new

Constructor Detail

def self.new(name : String, version : String = "0.1.0") #

[View source]

Instance Method Detail

def run(args : Array(String) = ARGV) : Int32 #

Runs the CLI with arguments (defaults to ARGV) and returns an exit code.


[View source]
def version : String #

[View source]
def version=(version : String) #

[View source]