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, #errornl, external, #fatal, findOpt, #findOpt, full, #givenCount, #givenSubcmd, #hasArg, #hasMany, #isExclusive, #isRequired, #isSwitch, main, #opt, #params, #parse, progname, reset, setMain, #setOptionSubcmd, #setRuleCheck, setSubcmd, #setUsageFooter, #setUsageHeader, #silent?, #suball, subcmd, #suboptDoc, #usage, #usageIfHelp, #usageNormal, 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.



1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
# File 'lib/como.rb', line 1958

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).



1954
1955
1956
# File 'lib/como.rb', line 1954

def author
  @author
end

#externalObject

Program external arguments:



1951
1952
1953
# File 'lib/como.rb', line 1951

def external
  @external
end

#yearObject (readonly)

Program author and year (date).



1954
1955
1956
# File 'lib/como.rb', line 1954

def year
  @year
end

Instance Method Details

#fullCommandObject

Full command name.



1972
1973
1974
# File 'lib/como.rb', line 1972

def fullCommand
    Opt.progname
end

#usageCommandObject

Usage printout for command.



1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
# File 'lib/como.rb', line 1978

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

    if @config[ :copyright ]
        str += "

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

    str
end