Skip to content

Commit

Permalink
No longer throw error with input '\' in interactive (Azure#6199)
Browse files Browse the repository at this point in the history
* No longer throw error with input '\'

* Address PR comment

* Fix linting error

* Address PR comment
  • Loading branch information
Ernest Wong authored and williexu committed Apr 24, 2018
1 parent 254cc5a commit 37db696
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
1 change: 1 addition & 0 deletions src/command_modules/azure-cli-interactive/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Release History
0.3.20
++++++
* Allow interactive completers to function with positional arguments.
* More user-friendly output when users type '\'

0.3.19
++++++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,8 @@ def _special_cases(self, cmd, outside):
elif SELECT_SYMBOL['query'] in cmd_stripped and self.last and self.last.result:
continue_flag = self.handle_jmespath_query(args)
telemetry.track_query_gesture()

elif not args:
continue_flag = True
elif args[0] == '--version' or args[0] == '-v':
try:
continue_flag = True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
import struct
import platform

from knack.log import get_logger


logger = get_logger(__name__)


def get_window_dim():
""" gets the dimensions depending on python version and os"""
Expand Down Expand Up @@ -55,17 +60,13 @@ def parse_quotes(cmd, quotes=True, string=True):
""" parses quotes """
import shlex

if quotes:
args = shlex.split(cmd)
else:
args = cmd.split()

if string:
str_args = []
for arg in args:
str_args.append(str(arg))
return str_args
return args
try:
args = shlex.split(cmd) if quotes else cmd.split()
except ValueError as exception:
logger.error(exception)
return []

return [str(arg) for arg in args] if string else args


def get_os_clear_screen_word():
Expand Down

0 comments on commit 37db696

Please sign in to comment.