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

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

Create program main option.



2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
# File 'lib/como.rb', line 2114

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

#authorObject (readonly)

Program author and year (date).



2110
2111
2112
# File 'lib/como.rb', line 2110

def author
  @author
end

#externalObject

Program external arguments:



2107
2108
2109
# File 'lib/como.rb', line 2107

def external
  @external
end

#yearObject (readonly)

Program author and year (date).



2110
2111
2112
# File 'lib/como.rb', line 2110

def year
  @year
end

Instance Method Details

#fullCommandObject

Full command name.



2128
2129
2130
# File 'lib/como.rb', line 2128

def fullCommand
    Opt.progname
end

#usageCommandObject

Usage printout for command.



2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
# File 'lib/como.rb', line 2134

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

    if @config[ :copyright ]
        str += "

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

    str
end