Skip to content

Commit 977c9d4

Browse files
author
Kirill V. Lyadvinsky
committed
Show help when no args passed
1 parent f8a4404 commit 977c9d4

File tree

6 files changed

+27
-4
lines changed

6 files changed

+27
-4
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ clean:
99
rm -rf test/__pycache__
1010
rm -rf zxtools/__pycache__
1111
rm -rf zxtools.egg-info
12+
rm -rf coverage.xml
1213

1314
coverage:
1415
coverage run --source zxtools setup.py test

test/test_hobeta.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ def test_args_parser(self):
2424
with self.assertRaises(SystemExit):
2525
hobeta.parse_args(("-h", "-v"))
2626

27+
with self.assertRaises(SystemExit):
28+
hobeta.parse_args(())
29+
2730
temp_in_file = tempfile.mkstemp()[1]
2831
input_file = open(temp_in_file, "w")
2932
input_file.close()

test/test_zeus2txt.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ def test_args_parser(self):
2525
with self.assertRaises(SystemExit):
2626
zeus2txt.parse_args(("-h", "-v"))
2727

28+
with self.assertRaises(SystemExit):
29+
zeus2txt.parse_args(())
30+
2831
temp_in_file = tempfile.mkstemp()[1]
2932
input_file = open(temp_in_file, "w")
3033
input_file.close()

zxtools/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
# See LICENSE file in the project root for full license information.
99
#
1010

11-
__version__ = '1.0.21'
12-
CHUNK_SIZE = 512 * 1024 # 512 KBytes
11+
__version__ = '1.0.22'
12+
CHUNK_SIZE = 512 * 1024 # 512 KBytes

zxtools/hobeta.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,15 @@ def parse_args(args):
153153
help="Show Hobeta header format description")
154154
help_parser.set_defaults(func=hobeta_help)
155155

156-
return parser.parse_args(args)
156+
try:
157+
options = parser.parse_args(args)
158+
if len(args) == 0:
159+
raise ValueError
160+
except:
161+
parser.print_help()
162+
sys.exit(0)
163+
164+
return options
157165

158166

159167
def main():

zxtools/zeus2txt.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,15 @@ def parse_args(args):
135135
action='store_true', help="Include original code in the output file")
136136
convert_parser.set_defaults(func=convert_file)
137137

138-
return parser.parse_args(args)
138+
try:
139+
options = parser.parse_args(args)
140+
if len(args) == 0:
141+
raise ValueError
142+
except:
143+
parser.print_help()
144+
sys.exit(0)
145+
146+
return options
139147

140148

141149
def main():

0 commit comments

Comments
 (0)