mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-05-25 06:33:43 +00:00
improved documentation
git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@1848 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
parent
fbdcbede28
commit
81c0fa70c1
2 changed files with 10 additions and 7 deletions
|
|
@ -86,6 +86,8 @@ LoggerKeys = ", ".join(["%r"%name for name in Loggers.keys()])
|
|||
|
||||
|
||||
def init_i18n ():
|
||||
"""Initialize i18n with the configured locale dir. The environment
|
||||
variable LOCPATH can also specify a locale dir."""
|
||||
locdir = os.environ.get('LOCPATH')
|
||||
if locdir is None:
|
||||
locdir = os.path.join(configdata.install_data, 'share', 'locale')
|
||||
|
|
|
|||
15
linkchecker
15
linkchecker
|
|
@ -35,7 +35,7 @@ default_timeout = 60
|
|||
socket.setdefaulttimeout(default_timeout)
|
||||
|
||||
import linkcheck
|
||||
# initialize i18n
|
||||
# initialize i18n, puts _() function into global namespace
|
||||
linkcheck.init_i18n()
|
||||
import linkcheck.log
|
||||
import linkcheck.optcomplete
|
||||
|
|
@ -190,7 +190,7 @@ class LCOptionParser (optparse.OptionParser, object):
|
|||
"""option parser with custom help text layout"""
|
||||
|
||||
def __init__ (self):
|
||||
# use our own formatter
|
||||
"""initializing using our own help formatter class"""
|
||||
super(LCOptionParser, self).__init__(formatter=LCHelpFormatter())
|
||||
|
||||
def error (self, msg):
|
||||
|
|
@ -373,12 +373,12 @@ optparser.add_option_group(group)
|
|||
################# auto completion #####################
|
||||
linkcheck.optcomplete.autocomplete(optparser)
|
||||
|
||||
# read and parser command line options and arguments
|
||||
# read and parse command line options and arguments
|
||||
(options, args) = optparser.parse_args()
|
||||
|
||||
# build a config object for this check session, also initializes logging
|
||||
# build a config object for this check session
|
||||
config = linkcheck.configuration.Configuration()
|
||||
# init logging
|
||||
# initialize logging
|
||||
config.init_logging(debug=options.debug)
|
||||
linkcheck.log.debug(linkcheck.LOG_CMDLINE, "Python %s on %s",
|
||||
sys.version, sys.platform)
|
||||
|
|
@ -498,14 +498,15 @@ if len(args) <= 0:
|
|||
else:
|
||||
linkcheck.log.warn(linkcheck.LOG_CMDLINE, _("no files or urls given"))
|
||||
|
||||
# initialize the cache and the consumer model
|
||||
cache = linkcheck.checker.cache.Cache()
|
||||
consumer = linkcheck.checker.consumer.Consumer(config, cache)
|
||||
# syntactic sugar
|
||||
for url in args:
|
||||
if url.lower().startswith("www."):
|
||||
url = "http://%s"%url
|
||||
url = "http://%s" % url
|
||||
elif url.lower().startswith("ftp."):
|
||||
url = "ftp://%s"%url
|
||||
url = "ftp://%s" % url
|
||||
url_data = linkcheck.checker.get_url_from(url, 0, consumer, cmdline=True)
|
||||
consumer.append_url(url_data)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue