1
0
mirror of https://github.com/wting/autojump synced 2024-10-27 20:34:07 +00:00

Remove unicode string parsing in argument handling

Defining argument strings explicitly as unicode causes problems in Python v3,
and the arguments are tested anyway in encode and decode functions.
This commit is contained in:
William Ting 2012-04-11 23:29:13 -10:00
parent 8decc17f3e
commit 0d421dcfa4

View File

@ -220,9 +220,9 @@ def shell_utility():
"""Run this when autojump is called as a shell utility""" """Run this when autojump is called as a shell utility"""
parser = argparse.ArgumentParser(description='Automatically jump to directory passed as an argument.', parser = argparse.ArgumentParser(description='Automatically jump to directory passed as an argument.',
epilog="Please see autojump(1) man pages for full documentation.") epilog="Please see autojump(1) man pages for full documentation.")
parser.add_argument('directory', metavar='DIR', type=unicode, nargs='*', default=u'', parser.add_argument('directory', metavar='DIR', nargs='*', default='',
help='directory to jump to') help='directory to jump to')
parser.add_argument('-a', '--add', metavar='DIR', type=unicode, parser.add_argument('-a', '--add', metavar='DIR',
help='manually add path to database') help='manually add path to database')
parser.add_argument('-b', '--bash', action="store_true", default=False, parser.add_argument('-b', '--bash', action="store_true", default=False,
help='enclose directory quotes to prevent errors') help='enclose directory quotes to prevent errors')
@ -261,7 +261,7 @@ def shell_utility():
#default: gradually forget about old directories #default: gradually forget about old directories
if (not args.completion): forget(path_dict, dic_file) if (not args.completion): forget(path_dict, dic_file)
if (args.directory == u''): if (args.directory == ''):
patterns = [unico("")] patterns = [unico("")]
else: else:
patterns = [decode(a) for a in args.directory] patterns = [decode(a) for a in args.directory]