Class: Como::MainOpt

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

Overview

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

Constant Summary

Constants inherited from ComoCommon

ComoCommon::VERSION

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, #apply, #applyConfig, #argById, #argByName, author, #check, #checkAlso, #checkMissing, #checkRule, #cmdline, configGet, configOverlay, configSet, current, default, #default, defaultOpt, #each, each, #each_given, each_given, #error, external, findOpt, #findOpt, full, #givenCount, #givenSubcmd, #hasArg, #hasMany, #isExclusive, #isRequired, #isSwitch, main, #opt, #params, #parse, progname, reset, setMain, #setRuleCheck, setSubcmd, #setSubopt, #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

Returns a new instance of MainOpt.



1856
1857
1858
1859
1860
1861
1862
1863
# File 'lib/como.rb', line 1856

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



1853
1854
1855
# File 'lib/como.rb', line 1853

def author
  @author
end

#externalObject

Program external arguments:



1850
1851
1852
# File 'lib/como.rb', line 1850

def external
  @external
end

#yearObject (readonly)

Program author and year (date).



1853
1854
1855
# File 'lib/como.rb', line 1853

def year
  @year
end

Instance Method Details

#fullCommandObject

Full command name.



1867
1868
1869
# File 'lib/como.rb', line 1867

def fullCommand
    Opt.progname
end

#usageCommandObject

Usage printout for command.



1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
# File 'lib/como.rb', line 1873

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

    if @config[ :copyright ]
        str += "

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

    str
end