Changeset 256

Show
Ignore:
Timestamp:
07/19/07 11:53:22 (1 year ago)
Author:
marc
Message:

Improved arugment handling and man pages across both branches

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/release/0.2/ChangeLog

    r254 r256  
    22 * Fixed a serious security bug in which /screenshot prompted no auth. Also 
    33 fixed sending the wrong Content-Lenght for the screenshot. Report Itaka 
    4  version on HTTP headers. 
    5  * Added RPM packages (backport from trunk) and minor UI fixes. 
     4 version on HTTP headers 
     5 * Added RPM packages (backport from trunk) and minor UI fixes 
     6 * Vastly improved console argument handling 
     7 * Improved man page 
    68 
    790.2 (I've been watching you...): 
  • branches/release/0.2/config.py

    r250 r256  
    5151image_dir = os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), "share/images/") 
    5252#: To be changed on install to specify where the installed files actually are 
    53 prefix = "/usr/share/itaka/images/
     53prefix = "/usr/share/itaka/images
    5454if os.path.exists(prefix): 
    5555    image_dir = prefix 
     
    114114    """ 
    115115 
    116     def __init__(self, arguments=None): 
     116    def __init__(self, arguments=1): 
    117117        """ 
    118118        Configuration engine constructor. It also handles whether the L{output} setting is set to print everything to the console. 
     
    121121        @param arguments: A tuple of sys.argv  
    122122        """ 
    123         if arguments is not None and len(arguments) > 1 and arguments[-1] == "-debug"
     123        if len(arguments) > 1 and arguments[-1] in ("--debug", "-d")
    124124            global output 
    125125            output = {'normal': True, 'debug': True, 'quiet': False} 
  • branches/release/0.2/console.py

    r173 r256  
    8787 
    8888        self.itakaglobals = itakaglobals 
    89         if self.itakaglobals.output['normal']:  
     89 
     90        if self.itakaglobals.output['debug']: 
     91            BaseMessage('Itaka %s (%s) starting' % (itakaglobals.version, itakaglobals.revision)) 
     92        elif self.itakaglobals.output['normal']:  
    9093            BaseMessage('Itaka %s starting' % (itakaglobals.version)) 
    9194             
  • branches/release/0.2/itaka.py

    r173 r256  
    2525import sys, traceback 
    2626 
    27 validarguments = ('-help', '-debug') 
     27validarguments = ('-h', '--help', '-v', '--version', '-r', '--revision', '-d', '--debug') 
    2828arguments = sys.argv 
    2929 
    3030# Only one option at a time 
    31 if len(arguments) > 2 or (len(arguments) == 2 and arguments[-1] not in validarguments or arguments[-1] == validarguments[0]): 
    32     print "Usage: %s (-debug|-help)" % (arguments[0]) 
     31if len(arguments) >= 2 and ((arguments[-1] not in validarguments) or (arguments[-1] in (validarguments[0], validarguments[1]))): 
     32    print """Usage: 
     33  %s [OPTION...] 
     34 
     35  Help Options: 
     36  -h, --help\t\t\t\tShow help options 
     37  -v, --version\t\t\t\tShow Itaka version 
     38  -r, --revision\t\t\tShow Itaka revision 
     39 
     40  Application Options: 
     41  -d, --debug\t\t\t\tStart in debug mode""" % arguments[0] 
    3342    sys.exit(1) 
    34 elif len(arguments) == 1: 
    35     arguments = None 
    3643 
    3744# Itaka core modules 
     
    5966 
    6067if __name__ == "__main__": 
     68    if len(arguments) >= 2:  
     69        if (arguments[-1] in (validarguments[2], validarguments[3])): 
     70            print itakaglobals.version 
     71            sys.exit(0) 
     72        if (arguments[-1] in (validarguments[4], validarguments[5])): 
     73            print itakaglobals.revision 
     74            sys.exit(0) 
     75 
    6176    try: 
    6277        gui = igui.Gui(console, (itakaglobals, configinstance)) 
  • branches/release/0.2/share/itaka.1

    r124 r256  
    88.PP  
    99Itaka is a on-demand screenshooting server based on the HTTP protocol. It integrates a specifically coded server to take screenshots on-demand when your machine is queried through a remote browser. It has a GTK GUI for client notification.  
     10.SH OPTIONS 
     11Itaka follows the usual GNU command line syntax, with long 
     12options starting with two dashes (`-'). 
     13A summary of options is included below. 
     14.TP 
     15.B \-h, \-\-help 
     16Show summary of options. 
     17.TP 
     18.B \-v, \-\-version 
     19Show version of program. 
     20.TP 
     21.B \-r, \-\-revision 
     22Show the revision of program. 
     23.TP 
     24.B \-d, \-\-debug 
     25Start in debug mode. 
    1026.SH "SEE ALSO"  
    1127.PP  
    12 /usr/share/doc/itaka/README.gz  
     28/usr/share/doc/itaka/README  
    1329.SH "AUTHOR"  
    1430.PP  
    15 Itaka was written by: Marc E. santusmarc@gmail.com.  
     31Itaka was written by: Marc E. <santusmarc@gmail.com> 
    1632.PP  
    1733This manual page was written by Marc E. santusmarc@gmail.com for  
  • trunk/ChangeLog

    r253 r256  
    1212 * Fixed a serious security bug in which /screenshot prompted no auth. Also 
    1313 fixed sending the wrong Content-Lenght for the screenshot. Report Itaka 
    14  version on HTTP headers. 
     14 version on HTTP headers 
     15 * Added RPM packages (backport from trunk) and minor UI fixes 
     16 * Vastly improved console argument handling 
     17 * Improved man page 
    1518 
    16190.2 (I've been watching you...): 
  • trunk/config.py

    r245 r256  
    101101    """ 
    102102 
    103     def __init__(self, arguments=None): 
     103    def __init__(self, arguments=1): 
    104104        """ 
    105105        Configuration engine constructor. It also handles whether the 
     
    110110        """ 
    111111 
    112         if arguments is not None and len(arguments) > 1 and arguments[-1] == '-debug'
     112        if len(arguments) > 1 and arguments[-1] in ('-d', '--debug')
    113113            global console_verbosity 
    114114            console_verbosity = {'normal': True, 'debug': True, 'quiet': False} 
  • trunk/console.py

    r246 r256  
    134134 
    135135        self.itaka_globals = itaka_globals 
    136         if self.itaka_globals.console_verbosity['normal']:  
    137             BaseMessage(_('Itaka %s starting') % (self.itaka_globals.__version__)) 
     136        if self.itaka_globals.console_verbosity['debug']: 
     137            BaseMessage(_('Itaka %s (%s) starting' % (self.itaka_globals.__version__, self.itaka_globals.__revision__))) 
     138        elif self.itaka_globals.console_verbosity['normal']:  
     139            BaseMessage(_('Itaka %s starting' % (self.itaka_globals.__version__))) 
    138140             
    139141    def message(self, message): 
  • trunk/itaka.py

    r241 r256  
    5959    gettext.textdomain('itaka') 
    6060 
    61 valid_arguments = ('-help', '-debug') 
     61validarguments = ('-h', '--help', '-v', '--version', '-r', '--revision', '-d', '--debug') 
    6262arguments = sys.argv 
    6363 
    64 # Only one option at a time 
    65 if len(arguments) > 2 or (len(arguments) == 2 and arguments[-1] \ 
    66         not in valid_arguments or arguments[-1] == valid_arguments[0]): 
    67     print _('Usage: %s (-debug|-help)') % (arguments[0]) 
     64if len(arguments) >= 2 and ((arguments[-1] not in validarguments) or (arguments[-1] in (validarguments[0], validarguments[1]))): 
     65    print """Usage: 
     66  %s [OPTION...] 
     67 
     68  Help Options: 
     69  -h, --help\t\t\t\tShow help options 
     70  -v, --version\t\t\t\tShow Itaka version 
     71  -r, --revision\t\t\tShow Itaka revision 
     72 
     73  Application Options: 
     74  -d, --debug\t\t\t\tStart in debug mode""" % arguments[0] 
    6875    sys.exit(1) 
    69 elif len(arguments) == 1: 
    70     arguments = None 
    7176 
    7277try: 
     
    8994 
    9095if __name__ == "__main__": 
     96    if len(arguments) >= 2: 
     97        if (arguments[-1] in (validarguments[2], validarguments[3])): 
     98            print itaka_globals.__version__ 
     99            sys.exit(0) 
     100        if (arguments[-1] in (validarguments[4], validarguments[5])): 
     101            print itaka_globals.__revision__ 
     102            sys.exit(0) 
     103 
    91104    try: 
    92105        gui = igui.Gui(console_instance, (itaka_globals, config_instance)) 
  • trunk/itaka.spec

    r235 r256  
    7676%{_prefix}/lib/itaka/screenshot.py 
    7777%{_prefix}/lib/itaka/console.py 
    78 %{_prefix}/lib/itaka/config.pyc 
    79 %{_prefix}/lib/itaka/console.pyc 
    80 %{_prefix}/lib/itaka/error.pyc 
    81 %{_prefix}/lib/itaka/itaka.pyc 
    82 %{_prefix}/lib/itaka/screenshot.pyc 
    83 %{_prefix}/lib/itaka/server.pyc 
    84 %{_prefix}/lib/itaka/uigtk.pyc 
    8578 
    8679%changelog 
  • trunk/share/itaka.1

    r124 r256  
    88.PP  
    99Itaka is a on-demand screenshooting server based on the HTTP protocol. It integrates a specifically coded server to take screenshots on-demand when your machine is queried through a remote browser. It has a GTK GUI for client notification.  
     10.SH OPTIONS 
     11Itaka follows the usual GNU command line syntax, with long 
     12options starting with two dashes (`-'). 
     13A summary of options is included below. 
     14.TP 
     15.B \-h, \-\-help 
     16Show summary of options. 
     17.TP 
     18.B \-v, \-\-version 
     19Show version of program. 
     20.TP 
     21.B \-r, \-\-revision 
     22Show the revision of program. 
     23.TP 
     24.B \-d, \-\-debug 
     25Start in debug mode. 
    1026.SH "SEE ALSO"  
    1127.PP  
    12 /usr/share/doc/itaka/README.gz  
     28/usr/share/doc/itaka/README  
    1329.SH "AUTHOR"  
    1430.PP  
    15 Itaka was written by: Marc E. santusmarc@gmail.com.  
     31Itaka was written by: Marc E. <santusmarc@gmail.com> 
    1632.PP  
    1733This manual page was written by Marc E. santusmarc@gmail.com for