Class: Como::MainOpt

Inherits:
Opt show all
Defined in:
lib/como.rb

Overview

Specialized Opt class for program (i.e. highest level subcommand).

Instance Attribute Summary (collapse)

Attributes inherited from Opt

#config, #doc, #given, #longOpt, #name, #parent, #rules, #shortOpt, #subcmd, #subopt, #type, #value

Instance Method Summary (collapse)

Methods inherited from Opt

[], #[], addOpt, #addOption, #addSubcmd, #apply, #applyConfig, #argById, #argByName, author, #check, #checkAlso, #checkMissing, #checkRule, #cmdline, configGet, configOverlay, configSet, current, default, #default, defaultOpt, each, #each, each_given, #each_given, error, #error, #errornl, #evalCheck, external, fatal, #fatal, findOpt, #findOpt, full, #givenCount, #givenSubcmd, #hasSwitchStyleDoc, main, #opt, #params, #parse, #prim?, progname, reset, setMain, #setOptionSubcmd, #setRuleCheck, setSubcmd, #setUsageFooter, #setUsageHeader, #suball, subcmd, #suboptDoc, #to_hash, #to_hopt, #usage, #usageIfHelp, #usageNormal, warn, #warn, year, #~

Methods inherited from ComoCommon

getIo, runHook, setHook, setIo

Constructor Details

- (MainOpt) initialize(author, year, name, opt, type, doc, value = nil)

Create program main option.



2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
# File 'lib/como.rb', line 2087

def initialize( author, year,
        name, opt,
        type, doc,
        value = nil )

    @author = author
    @year = year
    @external = nil
    super( name, opt, type, doc, value = nil )

end

Instance Attribute Details

- (Object) author (readonly)

Program author and year (date).



2083
2084
2085
# File 'lib/como.rb', line 2083

def author
  @author
end

- (Object) external

Program external arguments:



2080
2081
2082
# File 'lib/como.rb', line 2080

def external
  @external
end

- (Object) year (readonly)

Program author and year (date).



2083
2084
2085
# File 'lib/como.rb', line 2083

def year
  @year
end

Instance Method Details

- (Object) fullCommand

Full command name.



2101
2102
2103
# File 'lib/como.rb', line 2101

def fullCommand
    Opt.progname
end

- (Object) usageCommand

Usage printout for command.



2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
# File 'lib/como.rb', line 2107

def usageCommand
    str = "\
  #{fullCommand} #{cmdline.join(" ")}
"
    str += suboptDoc

    if @config[ :copyright ]
        str += "

  Copyright (c) #{Opt.year} by #{Opt.author}
"
    end

    str
end