1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-07-15 01:24:29 +02:00

reorganize main function. remove pass condition.

This commit is contained in:
Kelly Brazil
2021-05-12 15:19:11 -07:00
parent a205afb6f3
commit 3ed84f9f42

View File

@ -561,19 +561,13 @@ def main():
jc.utils.error_message(f'"{run_command_str}" command could not be run. For details use the -d or -dd option.')
sys.exit(combined_exit_code(magic_exit_code, JC_ERROR_EXIT))
elif run_command is None:
pass
# elif run_command is None:
# pass
else:
elif run_command is not None:
jc.utils.error_message(f'parser not found for "{run_command_str}". Use "jc -h" for help.')
sys.exit(combined_exit_code(magic_exit_code, JC_ERROR_EXIT))
if sys.stdin.isatty() and magic_stdout is None:
jc.utils.error_message('Missing piped data. Use "jc -h" for help.')
sys.exit(combined_exit_code(magic_exit_code, JC_ERROR_EXIT))
data = magic_stdout or sys.stdin.read()
# find the correct parser
if magic_found_parser:
parser = parser_module(magic_found_parser)
@ -595,6 +589,12 @@ def main():
sys.exit(combined_exit_code(magic_exit_code, JC_ERROR_EXIT))
# parse the data
if sys.stdin.isatty() and magic_stdout is None:
jc.utils.error_message('Missing piped data. Use "jc -h" for help.')
sys.exit(combined_exit_code(magic_exit_code, JC_ERROR_EXIT))
data = magic_stdout or sys.stdin.read()
try:
result = parser.parse(data, raw=raw, quiet=quiet)