Skip to content

Commit ee52dd4

Browse files
committed
pmv with no args prints help message
instead of crashing. Also revise TesterOptions, ViewerOptions to print pmt not pmt.py etc. regenerate notes/pmt.txt, pmv.txt with pmt etc not pmt.py etc.
1 parent 4aebdf6 commit ee52dd4

File tree

5 files changed

+16
-12
lines changed

5 files changed

+16
-12
lines changed

notes/pmt.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Usage: pmt.py [options] models
1+
Usage: pmt [options] models
22

33
models is a list of one or more module names (with no .py suffix).
44
Each module named in models must contain a model, that is: a model

notes/pmv.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Usage: pmv.py [options] models
1+
Usage: pmv [options] models
22

33
PyModel Viewer. A single program that invokes pma, pmg, and Graphviz
44
dot to to perform analysis, generate dot commands, and generate a file

pymodel/TesterOptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from optparse import OptionParser
66

7-
usage = """pmt.py [options] models
7+
usage = """pmt [options] models
88
99
models is a list of one or more module names (with no .py suffix).
1010
Each module named in models must contain a model, that is: a model

pymodel/ViewerOptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from optparse import OptionParser
66

7-
usage = """pmv.py [options] models
7+
usage = """pmv [options] models
88
99
PyModel Viewer. A single program that invokes pma, pmg, and Graphviz
1010
dot to to perform analysis, generate dot commands, and generate a file

pymodel/pmv.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,18 @@ def command(cmd):
3434

3535
def main():
3636
(options, args) = ViewerOptions.parse_args()
37-
basename = options.__dict__['output'] if options.__dict__['output'] else '%sFSM' % args[0]
38-
pma = 'pma ' + make_opts(pma_keys, options) + ' ' + ' '.join(args)
39-
command(pma)
40-
pmg = 'pmg ' + make_opts(pmg_keys, options) + ' %s' % basename
41-
command(pmg)
42-
dot = 'dot -T%(type)s -o %(name)s.%(type)s %(name)s.dot' % \
43-
{'type': options.__dict__['fileType'], 'name': basename}
44-
command(dot)
37+
if not args:
38+
ViewerOptions.print_help()
39+
exit()
40+
else:
41+
basename = options.__dict__['output'] if options.__dict__['output'] else '%sFSM' % args[0]
42+
pma = 'pma ' + make_opts(pma_keys, options) + ' ' + ' '.join(args)
43+
command(pma)
44+
pmg = 'pmg ' + make_opts(pmg_keys, options) + ' %s' % basename
45+
command(pmg)
46+
dot = 'dot -T%(type)s -o %(name)s.%(type)s %(name)s.dot' % \
47+
{'type': options.__dict__['fileType'], 'name': basename}
48+
command(dot)
4549

4650
if __name__ == ' __main__':
4751
main()

0 commit comments

Comments
 (0)