diff --git a/py/hexagram/path.py b/py/hexagram/path.py index 024c956..83a7fc8 100644 --- a/py/hexagram/path.py +++ b/py/hexagram/path.py @@ -27,12 +27,10 @@ class PathCommand(): self.arg += ch def arg_next(self, ch: str): - if len(self.arg) == 0: - return + if len(self.arg) > 0: + self.args.append(self.arg) - self.arg += ch - self.args.append(self.arg) - self.arg = '' + self.arg = ch def arg_finish(self): if len(self.arg) > 0: @@ -115,6 +113,8 @@ class Path(): command.set_command(ch) elif Path.is_number(c): command.arg_addch(ch) + elif ch == '-': + command.arg_next(ch) elif ch == ' ' or ch == ',': state = State.INT command.arg_finish()