Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions dex
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ class Application(DesktopEntry):
)

@classmethod
def _build_cmd(cls, exec_string, needs_terminal=False, term="x-terminal-emulator"):
def _build_cmd(cls, exec_string:str, needs_terminal=False, term="x-terminal-emulator"):
"""
# test single and multi argument commands
>>> Application._build_cmd('gvim')
Expand All @@ -408,12 +408,12 @@ class Application(DesktopEntry):
['gvim test']

# test escape sequences
# >>> Application._build_cmd('"gvim test" test2 "test \\\\" 3"')
# ['gvim test', 'test2', 'test " 3']
# >>> Application._build_cmd(r'"test \\\\\\\\ \\" moin" test')
# ['test \\\\ " moin', 'test']
# >>> Application._build_cmd(r'"gvim \\\\\\\\ \\`test\\$"')
# ['gvim \\\\ \\`test\\$']
>>> Application._build_cmd('"gvim test" test2 "test \\\\" 3"')
['gvim test', 'test2', 'test " 3']
>>> Application._build_cmd(r'"test \\\\\\\\ \\" moin" test')
['test \\\\ " moin', 'test']
>>> Application._build_cmd(r'"gvim \\\\\\\\ \\`test\\$"')
['gvim \\\\ `test$']
>>> Application._build_cmd(r'vim ~/.vimrc', True)
['x-terminal-emulator', '-e', 'vim', '~/.vimrc']
>>> Application._build_cmd('vim ~/.vimrc', False)
Expand Down Expand Up @@ -501,9 +501,8 @@ class Application(DesktopEntry):
continue

elif c == "\\":
if not in_quote:
in_esc = True
continue
in_esc = True
continue

elif c == "%" and not (in_quote or in_singlequote):
in_fieldcode = True
Expand Down Expand Up @@ -879,7 +878,6 @@ def _property(args):
print("Parse failed: %s%s%s" % (f, os.linesep, ex), file=sys.stderr)
return exit_value


# start execution
if __name__ == "__main__":
from argparse import ArgumentParser
Expand Down