mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-05-15 18:13:09 +00:00
optional optcomplete
git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@2123 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
parent
b06f144ced
commit
adcaf770e5
1 changed files with 9 additions and 4 deletions
13
linkchecker
13
linkchecker
|
|
@ -39,11 +39,15 @@ import linkcheck
|
|||
# initialize i18n, puts _() function into global namespace
|
||||
linkcheck.init_i18n()
|
||||
import linkcheck.log
|
||||
import optcomplete
|
||||
import linkcheck.checker
|
||||
import linkcheck.checker.cache
|
||||
import linkcheck.checker.consumer
|
||||
import linkcheck.configuration
|
||||
try:
|
||||
import optcomplete
|
||||
has_optcomplete = True
|
||||
except ImportError:
|
||||
has_optcomplete = False
|
||||
|
||||
|
||||
# default profiling filename
|
||||
|
|
@ -220,8 +224,8 @@ class LCOptionParser (optparse.OptionParser, object):
|
|||
|
||||
def print_help (self, file=None):
|
||||
"""print translated help text"""
|
||||
s = "%s\n%s\n%s"%(self.format_help(), Notes, Examples)
|
||||
if os.name!='posix':
|
||||
s = "%s\n%s\n%s" % (self.format_help(), Notes, Examples)
|
||||
if os.name != 'posix':
|
||||
linkcheck.StringUtil.paginate(s)
|
||||
else:
|
||||
print s
|
||||
|
|
@ -394,7 +398,8 @@ group.add_option("--status", action="store_true", dest="status",
|
|||
optparser.add_option_group(group)
|
||||
|
||||
################# auto completion #####################
|
||||
optcomplete.autocomplete(optparser)
|
||||
if has_optcomplete:
|
||||
optcomplete.autocomplete(optparser)
|
||||
|
||||
# read and parse command line options and arguments
|
||||
(options, args) = optparser.parse_args()
|
||||
|
|
|
|||
Loading…
Reference in a new issue