From 2fb6ae08d76e7a5727b2fcdd5def3e3822e0cf72 Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Thu, 13 Feb 2020 12:17:41 -0800 Subject: [PATCH] fix shlex usage --- jc/cli.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jc/cli.py b/jc/cli.py index 4dcf9962..caa3f217 100644 --- a/jc/cli.py +++ b/jc/cli.py @@ -4,6 +4,7 @@ JC cli module """ import sys import os +import shlex import importlib import textwrap import signal @@ -182,8 +183,8 @@ def magic(): """Parse with magic syntax: jc -p ls -al""" if len(sys.argv) > 1 and not sys.argv[1].startswith('--'): parser_info = about_jc()['parsers'] - # how can i get the literal text of the command entered instead of the argument list? - args_given = sys.argv[1:] + # correctly parse escape characters and spaces with shlex + args_given = " ".join(map(shlex.quote, sys.argv[1:])).split() options = [] found_parser = None