1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-19 00:17:51 +02:00

Raise exceptions unless the -q or quiet flag are used

This commit is contained in:
Kelly Brazil
2021-09-12 16:35:46 -07:00
parent 3d10fd40b5
commit 5e7f302a9c

View File

@ -70,7 +70,6 @@ class info():
# compatible options: linux, darwin, cygwin, win32, aix, freebsd # compatible options: linux, darwin, cygwin, win32, aix, freebsd
compatible = ['linux', 'darwin', 'cygwin', 'aix', 'freebsd'] compatible = ['linux', 'darwin', 'cygwin', 'aix', 'freebsd']
# magic_commands = ['ls', 'vdir']
streaming = True streaming = True
@ -172,7 +171,7 @@ def parse(data, raw=False, quiet=False):
# Only support -l option # Only support -l option
if not re.match(r'[-dclpsbDCMnP?]([-r][-w][-xsS]){2}([-r][-w][-xtT])[+]?', line): if not re.match(r'[-dclpsbDCMnP?]([-r][-w][-xsS]){2}([-r][-w][-xtT])[+]?', line):
raise ParseError raise ParseError(f'Unparsable line: {line[0:60]}')
# split filenames and links # split filenames and links
if len(parsed_line) == 9: if len(parsed_line) == 9:
@ -204,6 +203,9 @@ def parse(data, raw=False, quiet=False):
yield _process(output_line) yield _process(output_line)
except Exception: except Exception:
if not quiet:
raise
else:
yield { yield {
'_meta': '_meta':
{ {