Skip to content

Commit 0149e04

Browse files
committed
Make pycdlib-explorer error messages print the help.
Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
1 parent 6192725 commit 0149e04

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

tools/pycdlib-explorer

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ class PyCdlibCmdLoop(cmd.Cmd):
6868
def do_quit(self, line):
6969
"""The other command to quit the program."""
7070
if line:
71-
print('No parameters allowed for quit')
71+
self.help_quit()
7272
return False
7373
return True
7474

7575
def do_EOF(self, line): # pylint: disable=unused-argument
76-
"""Handel EOF on the terminal."""
76+
"""Handle EOF on the terminal."""
7777
print()
7878
return True
7979

@@ -107,7 +107,7 @@ class PyCdlibCmdLoop(cmd.Cmd):
107107
print(self.print_mode)
108108
return False
109109
if splitlen != 1:
110-
print('Only a single parameter allowed for print_mode')
110+
self.help_print_mode()
111111
return False
112112

113113
if split[0] not in self.PRINT_MODES:
@@ -149,7 +149,7 @@ class PyCdlibCmdLoop(cmd.Cmd):
149149
def do_ls(self, line):
150150
"""The command to list the contents of a directory."""
151151
if line:
152-
print('No parameters allowed for ls')
152+
self.help_ls()
153153
return False
154154

155155
diriter = self.iso.list_children(**{self.pathname: self.cwds[self.print_mode]})
@@ -198,7 +198,7 @@ class PyCdlibCmdLoop(cmd.Cmd):
198198
"""
199199
split = shlex.split(line)
200200
if len(split) != 1:
201-
print('The cd command supports one and only one parameter')
201+
self.help_cd()
202202
return False
203203

204204
directory = split[0]
@@ -227,7 +227,7 @@ class PyCdlibCmdLoop(cmd.Cmd):
227227
"""
228228
split = shlex.split(line)
229229
if len(split) != 2:
230-
print('The get command must be passed two parameters.')
230+
self.help_get()
231231
return False
232232

233233
iso_file = split[0]
@@ -249,7 +249,7 @@ class PyCdlibCmdLoop(cmd.Cmd):
249249
def do_cwd(self, line):
250250
"""The command to find out what the current working directory is."""
251251
if line:
252-
print('No parameters allowed for cwd')
252+
self.help_cwd()
253253
return False
254254

255255
print(self.cwds[self.print_mode])
@@ -267,7 +267,7 @@ class PyCdlibCmdLoop(cmd.Cmd):
267267
current working directory in a convenient tree-like form.
268268
"""
269269
if line:
270-
print('No parameters allowed for tree')
270+
self.help_tree()
271271
return False
272272

273273
utf8_corner = '└──'
@@ -333,7 +333,7 @@ class PyCdlibCmdLoop(cmd.Cmd):
333333
"""
334334
split = shlex.split(line)
335335
if len(split) != 1:
336-
print('The write command supports one and only one parameter.')
336+
self.help_write()
337337
return False
338338

339339
self.iso.write(split[0])
@@ -439,7 +439,7 @@ class PyCdlibCmdLoop(cmd.Cmd):
439439
"""
440440
split = shlex.split(line)
441441
if len(split) != 1:
442-
print('The rm_file command takes one and only one parameter (iso path).')
442+
self.help_rm_file()
443443
return False
444444

445445
iso_path = split[0]
@@ -514,7 +514,7 @@ class PyCdlibCmdLoop(cmd.Cmd):
514514
"""
515515
split = shlex.split(line)
516516
if len(split) != 1:
517-
print('The rmdir command takes one and only one parameter (iso path).')
517+
self.help_rmdir()
518518
return False
519519

520520
iso_path = split[0]

0 commit comments

Comments
 (0)