MCPcopy Create free account
hub / github.com/antirez/freakwan / split_arguments

Method split_arguments

clictrl.py:62–79  ·  view source on GitHub ↗
(self,cmd)

Source from the content-addressed store, hash-verified

60 # Split command arguments, trying to consider "strings with quotes
61 # and spaces" as a single one. So the user can type: !cmd "argu ment".
62 def split_arguments(self,cmd):
63 sp = cmd.split()
64 argv = []
65 in_quotes = False
66 for a in sp:
67 if in_quotes:
68 if len(a) and a[-1] == '"':
69 a = a[:-1]
70 in_quotes = False
71 argv[-1] += " "+a
72 else:
73 if len(a) and a[0] == '"' and a[-1] == '"':
74 a = a[1:-1]
75 elif len(a) and a[0] == '"':
76 a = a[1:]
77 in_quotes = True
78 argv.append(a)
79 return argv
80
81 # 'command' is the command string to execute, while 'fw' is
82 # our FreaWAN application class, used by the CommandsController

Callers 1

exec_user_commandMethod · 0.95

Calls 1

appendMethod · 0.80

Tested by

no test coverage detected