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?, arg(name : Symbol, description : String = "", required : Bool = false, default : String | Nil = nil, type : Symbol = :string, multiple : Bool = false, choices : Array(String) | Nil = nil, value_name : String | Nil = nil) : self arg, argument(name : Symbol, description : String = "", required : Bool = false, default : String | Nil = nil, type : Symbol = :string, multiple : Bool = false, choices : Array(String) | Nil = nil, value_name : String | Nil = nil) : self argument, arguments : Array(Argument) arguments, arguments=(arguments : Array(Argument)) arguments=, banner(text : String) : self banner, 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
, commands : Hash(String, Command) commands, description(desc : String) : self
description : String
description
, description=(description : String) description=, epilog(text : String) : self epilog, 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, footer(text : String) : self footer, footer_text : String | Nil footer_text, footer_text=(footer_text : String | Nil) footer_text=, group(name : String, &block : -> Nil) : self group, header(text : String) : self header, header_text : String | Nil header_text, header_text=(header_text : String | Nil) header_text=, 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, opt(name : Symbol, spec : String, description : String = "", type : Symbol | Nil = nil, default : OptionValue = nil, required : Bool = false, global : Bool = false, choices : Array(String) | Nil = nil, env_var : String | Nil = nil, group : String | Nil = nil) : self opt, 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, section(title : String, &block : HelpSection -> Nil) : self section, sections : Array(HelpSection) sections, sections=(sections : Array(HelpSection)) sections=, 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=, summary(text : String) : self
summary : String | Nil
summary
, summary=(summary : String | Nil) summary=, title(text : String) : self
title : String | Nil
title
, title=(title : String | Nil) title=

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]