Stuff
public text v1 · immutableimport getopt, sys
try:
opts, args = getopt.getopt(sys.argv[1:], "c:")
except getopt.GetoptError, detail:
print>>sys.stderr, detail
print>>sys.stderr, "Usage: pyvcp -c hal_component_name myfile.xml"
sys.exit(1)
else:
print opts
print args
$ python /tmp/go.py -c
option -c requires argument
Usage: pyvcp -c hal_component_name myfile.xml
$ python /tmp/go.py -x
option -x not recognized
Usage: pyvcp -c hal_component_name myfile.xml