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, #apply, #applyConfig, #argById, #argByName, author, #check, #checkAlso, #checkMissing, #checkRule, #cmdline, configOverlay, 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, #usageNormalOld, year, #~

Methods inherited from ComoCommon

getIo, setIo

Constructor Details

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

Returns a new instance of MainOpt.



1758
1759
1760
1761
1762
1763
1764
1765
# File 'lib/como.rb', line 1758

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



1755
1756
1757
# File 'lib/como.rb', line 1755

def author
  @author
end

#externalObject

Program external arguments:



1752
1753
1754
# File 'lib/como.rb', line 1752

def external
  @external
end

#yearObject (readonly)

Program author and year (date).



1755
1756
1757
# File 'lib/como.rb', line 1755

def year
  @year
end

Instance Method Details

#fullCommandObject

Full command name.



1769
1770
1771
# File 'lib/como.rb', line 1769

def fullCommand
    Opt.progname
end

#usageCommandObject

Usage printout for command.



1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
# File 'lib/como.rb', line 1791

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

"
    str += suboptDoc

    str += "

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

#usageCommandOldObject

Usage printout for command.



1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
# File 'lib/como.rb', line 1775

def usageCommandOld
    str = "
  Usage:
    #{fullCommand} #{cmdline.join(" ")}

"
    str += suboptDoc

    str += "

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

"
end