diff options
Diffstat (limited to 'nikola/__main__.py')
| -rw-r--r-- | nikola/__main__.py | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/nikola/__main__.py b/nikola/__main__.py index 2aa63f4..f002768 100644 --- a/nikola/__main__.py +++ b/nikola/__main__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright © 2012-2015 Roberto Alsina and others. +# Copyright © 2012-2016 Roberto Alsina and others. # Permission is hereby granted, free of charge, to any # person obtaining a copy of this software and associated @@ -44,6 +44,7 @@ from doit.doit_cmd import DoitMain from doit.cmd_help import Help as DoitHelp from doit.cmd_run import Run as DoitRun from doit.cmd_clean import Clean as DoitClean +from doit.cmd_completion import TabCompletion from doit.cmd_auto import Auto as DoitAuto from logbook import NullHandler from blinker import signal @@ -67,7 +68,7 @@ _RETURN_DOITNIKOLA = False def main(args=None): """Run Nikola.""" colorful = False - if sys.stderr.isatty() and os.name != 'nt': + if sys.stderr.isatty() and os.name != 'nt' and os.getenv('NIKOLA_MONO') is None: colorful = True ColorfulStderrHandler._colorful = colorful @@ -175,7 +176,6 @@ def main(args=None): class Help(DoitHelp): - """Show Nikola usage.""" @staticmethod @@ -199,7 +199,6 @@ class Help(DoitHelp): class Build(DoitRun): - """Expose "run" command as "build" for backwards compatibility.""" def __init__(self, *args, **kw): @@ -238,7 +237,6 @@ class Build(DoitRun): class Clean(DoitClean): - """Clean site, including the cache directory.""" def clean_tasks(self, tasks, dryrun): @@ -255,7 +253,6 @@ DoitAuto.name = 'doit_auto' class NikolaTaskLoader(TaskLoader): - """Nikola-specific task loader.""" def __init__(self, nikola, quiet=False): @@ -288,7 +285,6 @@ class NikolaTaskLoader(TaskLoader): class DoitNikola(DoitMain): - """Nikola-specific implementation of DoitMain.""" # overwite help command @@ -336,6 +332,8 @@ class DoitNikola(DoitMain): if args[0] == 'help': self.nikola.init_plugins(commands_only=True) + elif args[0] == 'plugin': + self.nikola.init_plugins(load_all=True) else: self.nikola.init_plugins() @@ -359,7 +357,7 @@ class DoitNikola(DoitMain): LOGGER.info('Did you mean "{}" or "{}"?'.format('", "'.join(best_sugg[:-1]), best_sugg[-1])) return 3 - if sub_cmds[args[0]] is not Help and not isinstance(sub_cmds[args[0]], Command): # Is a doit command + if not sub_cmds[args[0]] in (Help, TabCompletion) and not isinstance(sub_cmds[args[0]], Command): if not self.nikola.configured: LOGGER.error("This command needs to run inside an " "existing Nikola site.") @@ -399,5 +397,6 @@ def levenshtein(s1, s2): return previous_row[-1] + if __name__ == "__main__": sys.exit(main(sys.argv[1:])) |
