2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-21 17:12:22 +00:00

- Added new flags: -h, --help, -v, --version

[SVN r18058]
This commit is contained in:
Bruno da Silva de Oliveira
2003-03-22 18:20:16 +00:00
parent 6b7748a88d
commit 93df7e00a7

View File

@@ -1,4 +1,6 @@
'''
Pyste version %s
Usage:
pyste [options] --module=<name> interface-files
@@ -9,6 +11,8 @@ where options are:
use explicit declarations instead
--pyste-ns=<name> set the namespace where new types will be declared;
default is "pyste"
-h, --help print this help and exit
-v, --version print version information
'''
import sys
@@ -27,6 +31,7 @@ from ClassExporter import ClassExporter
from IncludeExporter import IncludeExporter
from HeaderExporter import HeaderExporter
__VERSION__ = '0.5.8'
def GetDefaultIncludes():
if 'INCLUDE' in os.environ:
@@ -39,10 +44,18 @@ def GetDefaultIncludes():
def ParseArguments():
def Usage():
print __doc__
print __doc__ % __VERSION__
sys.exit(1)
options, files = getopt.getopt(sys.argv[1:], 'I:D:', ['module=', 'out=', 'no-using', 'pyste-ns=', 'debug'])
try:
options, files = getopt.getopt(
sys.argv[1:],
'I:D:vh',
['module=', 'out=', 'no-using', 'pyste-ns=', 'debug', 'version', 'help'])
except getopt.GetoptError, e:
print
print 'ERROR:', e
Usage()
includes = GetDefaultIncludes()
defines = []
module = None
@@ -63,6 +76,11 @@ def ParseArguments():
settings.namespaces.pyste = value + '::'
elif opt == '--debug':
settings.DEBUG = True
elif opt in ['-h', '--help']:
Usage()
elif opt in ['-v', '--version']:
print 'Pyste version %s' % __VERSION__
sys.exit(2)
else:
print 'Unknown option:', opt
Usage()