summaryrefslogtreecommitdiff
path: root/domestic/parse/command_argument_parser.py
diff options
context:
space:
mode:
Diffstat (limited to 'domestic/parse/command_argument_parser.py')
-rw-r--r--domestic/parse/command_argument_parser.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/domestic/parse/command_argument_parser.py b/domestic/parse/command_argument_parser.py
new file mode 100644
index 0000000..9358d76
--- /dev/null
+++ b/domestic/parse/command_argument_parser.py
@@ -0,0 +1,21 @@
+def command_argument_parser(message):
+ arguments = message.split('--')
+ first = arguments[0]
+
+ if first.endswith(' '):
+ first = first[:-1]
+
+ arguments_dict = {'message': first}
+
+ for argument in arguments[1:]:
+ key_value_list = [y for y in argument.split(' ') if y != '']
+
+ key = key_value_list[0]
+ value = key_value_list[1:]
+
+ if len(key_value_list) == 1:
+ arguments_dict[key] = True
+ else:
+ arguments_dict[key] = ' '.join(value)
+
+ return arguments_dict \ No newline at end of file