mirror of
https://github.com/wting/autojump
synced 2024-10-27 20:34:07 +00:00
add version and help options
This commit is contained in:
parent
e1ee172437
commit
f438372616
8
autojump
8
autojump
@ -31,6 +31,7 @@ from sys import argv, stderr, version_info, exit
|
|||||||
from tempfile import NamedTemporaryFile
|
from tempfile import NamedTemporaryFile
|
||||||
from operator import itemgetter
|
from operator import itemgetter
|
||||||
import os
|
import os
|
||||||
|
AUTOJUMP_VERSION = "release v17"
|
||||||
MAX_KEYWEIGHT = 1000
|
MAX_KEYWEIGHT = 1000
|
||||||
MAX_STORED_PATHS = 600
|
MAX_STORED_PATHS = 600
|
||||||
COMPLETION_SEPARATOR = '__'
|
COMPLETION_SEPARATOR = '__'
|
||||||
@ -156,7 +157,7 @@ def shell_utility():
|
|||||||
"""Run this when autojump is called as a shell utility"""
|
"""Run this when autojump is called as a shell utility"""
|
||||||
try:
|
try:
|
||||||
optlist, args = getopt.getopt(argv[1:], 'a',
|
optlist, args = getopt.getopt(argv[1:], 'a',
|
||||||
['stat', 'import', 'completion', 'bash'])
|
['stat', 'import', 'completion', 'bash', 'version', 'help'])
|
||||||
except getopt.GetoptError as ex:
|
except getopt.GetoptError as ex:
|
||||||
print("Unknown command line argument: %s" % ex)
|
print("Unknown command line argument: %s" % ex)
|
||||||
exit(1)
|
exit(1)
|
||||||
@ -176,6 +177,11 @@ def shell_utility():
|
|||||||
print("%.1f:\t%s" % (count, path))
|
print("%.1f:\t%s" % (count, path))
|
||||||
print("Total key weight: %d. Number of stored paths: %d" %
|
print("Total key weight: %d. Number of stored paths: %d" %
|
||||||
(sum(path_dict.values()), len(paths)))
|
(sum(path_dict.values()), len(paths)))
|
||||||
|
elif ('--version', '') in optlist:
|
||||||
|
print("autojump %s" % AUTOJUMP_VERSION)
|
||||||
|
elif ('--help', '') in optlist:
|
||||||
|
print("usage: j <dirspec>")
|
||||||
|
print("where dirspec is a few characters of the directory you want to jump to.")
|
||||||
else:
|
else:
|
||||||
import re
|
import re
|
||||||
completion = False
|
completion = False
|
||||||
|
Loading…
Reference in New Issue
Block a user