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

fix shlex usage

This commit is contained in:
Kelly Brazil
2020-02-13 12:17:41 -08:00
parent bf8811e03e
commit 2fb6ae08d7

View File

@ -4,6 +4,7 @@ JC cli module
""" """
import sys import sys
import os import os
import shlex
import importlib import importlib
import textwrap import textwrap
import signal import signal
@ -182,8 +183,8 @@ def magic():
"""Parse with magic syntax: jc -p ls -al""" """Parse with magic syntax: jc -p ls -al"""
if len(sys.argv) > 1 and not sys.argv[1].startswith('--'): if len(sys.argv) > 1 and not sys.argv[1].startswith('--'):
parser_info = about_jc()['parsers'] parser_info = about_jc()['parsers']
# how can i get the literal text of the command entered instead of the argument list? # correctly parse escape characters and spaces with shlex
args_given = sys.argv[1:] args_given = " ".join(map(shlex.quote, sys.argv[1:])).split()
options = [] options = []
found_parser = None found_parser = None