We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Nikola needs a -q (quiet) switch for testing and other automated tasks
Just needs to hide NOTICEs


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `nikola/main.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 
3 # Copyright © 2012-2013 Roberto Alsina and others.
4 
5 # Permission is hereby granted, free of charge, to any
6 # person obtaining a copy of this software and associated
7 # documentation files (the "Software"), to deal in the
8 # Software without restriction, including without limitation
9 # the rights to use, copy, modify, merge, publish,
10 # distribute, sublicense, and/or sell copies of the
11 # Software, and to permit persons to whom the Software is
12 # furnished to do so, subject to the following conditions:
13 #
14 # The above copyright notice and this permission notice
15 # shall be included in all copies or substantial portions of
16 # the Software.
17 #
18 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
19 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
20 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
21 # PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
22 # OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23 # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24 # OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25 # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 
27 from __future__ import print_function, unicode_literals
28 from operator import attrgetter
29 import os
30 import shutil
31 import sys
32 import traceback
33 
34 from doit.loader import generate_tasks
35 from doit.cmd_base import TaskLoader
36 from doit.reporter import ExecutedOnlyReporter
37 from doit.doit_cmd import DoitMain
38 from doit.cmd_help import Help as DoitHelp
39 from doit.cmd_run import Run as DoitRun
40 from doit.cmd_clean import Clean as DoitClean
41 
42 from . import __version__
43 from .nikola import Nikola
44 from .utils import _reload, sys_decode, LOGGER, STRICT_HANDLER
45 
46 
47 config = {}
48 
49 
50 def main(args):
51     if len(args) > 0 and args[0] == 'build' and '--strict' in args:
52         LOGGER.notice('Running in strict mode')
53         STRICT_HANDLER.push_application()
54     global config
55     sys.path.append('')
56     try:
57         import conf
58         _reload(conf)
59         config = conf.__dict__
60     except Exception:
61         if os.path.exists('conf.py'):
62             msg = traceback.format_exc(0).splitlines()[1]
63             LOGGER.error('In conf.py line {0}: {1}'.format(sys.exc_info()[2].tb_lineno, msg))
64             sys.exit(1)
65         config = {}
66 
67     site = Nikola(**config)
68     return DoitNikola(site).run(args)
69 
70 
71 class Help(DoitHelp):
72     """show Nikola usage instead of doit """
73 
74     @staticmethod
75     def print_usage(cmds):
76         """print nikola "usage" (basic help) instructions"""
77         print("Nikola is a tool to create static websites and blogs. For full documentation and more information, please visit http://getnikola.com\n\n")
78         print("Available commands:")
79         for cmd in sorted(cmds.values(), key=attrgetter('name')):
80             print("  nikola %-*s %s" % (20, cmd.name, cmd.doc_purpose))
81         print("")
82         print("  nikola help                 show help / reference")
83         print("  nikola help <command>       show command usage")
84         print("  nikola help <task-name>     show task usage")
85 
86 
87 class Build(DoitRun):
88     """expose "run" command as "build" for backward compatibility"""
89     def __init__(self, *args, **kw):
90         opts = list(self.cmd_options)
91         opts.append(
92             {
93                 'name': 'strict',
94                 'long': 'strict',
95                 'default': False,
96                 'type': bool,
97                 'help': "Fail on things that would normally be warnings.",
98             }
99         )
100         self.cmd_options = tuple(opts)
101         super(Build, self).__init__(*args, **kw)
102 
103 
104 class Clean(DoitClean):
105     """A clean that removes cache/"""
106 
107     def clean_tasks(self, tasks, dryrun):
108         if not dryrun and config:
109             cache_folder = config.get('CACHE_FOLDER', 'cache')
110             if os.path.exists(cache_folder):
111                 shutil.rmtree(cache_folder)
112         return super(Clean, self).clean_tasks(tasks, dryrun)
113 
114 
115 class NikolaTaskLoader(TaskLoader):
116     """custom task loader to get tasks from Nikola instead of dodo.py file"""
117     def __init__(self, nikola):
118         self.nikola = nikola
119 
120     def load_tasks(self, cmd, opt_values, pos_args):
121         DOIT_CONFIG = {
122             'reporter': ExecutedOnlyReporter,
123             'default_tasks': ['render_site', 'post_render'],
124         }
125         tasks = generate_tasks('render_site', self.nikola.gen_tasks('render_site', "Task"))
126         latetasks = generate_tasks('post_render', self.nikola.gen_tasks('post_render', "LateTask"))
127         return tasks + latetasks, DOIT_CONFIG
128 
129 
130 class DoitNikola(DoitMain):
131     # overwite help command
132     DOIT_CMDS = list(DoitMain.DOIT_CMDS) + [Help, Build, Clean]
133     TASK_LOADER = NikolaTaskLoader
134 
135     def __init__(self, nikola):
136         self.nikola = nikola
137         self.task_loader = self.TASK_LOADER(nikola)
138 
139     def get_commands(self):
140         # core doit commands
141         cmds = DoitMain.get_commands(self)
142         # load nikola commands
143         for name, cmd in self.nikola.commands.items():
144             cmds[name] = cmd
145         return cmds
146 
147     def run(self, cmd_args):
148         sub_cmds = self.get_commands()
149         args = self.process_args(cmd_args)
150         args = [sys_decode(arg) for arg in args]
151 
152         if len(args) == 0 or any(arg in ["--help", '-h'] for arg in args):
153             cmd_args = ['help']
154             args = ['help']
155             # Hide run because Nikola uses build
156             sub_cmds.pop('run')
157 
158         if len(args) == 0 or args[0] not in sub_cmds.keys() or \
159                 args[0] == 'build':
160             # Check for conf.py before launching run
161             if not self.nikola.configured:
162                 LOGGER.error("This command needs to run inside an "
163                              "existing Nikola site.")
164                 return False
165         return super(DoitNikola, self).run(cmd_args)
166 
167     @staticmethod
168     def print_version():
169         print("Nikola version " + __version__)
170
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/nikola/main.py b/nikola/main.py
--- a/nikola/main.py
+++ b/nikola/main.py
@@ -38,6 +38,7 @@
 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 logbook import NullHandler
 
 from . import __version__
 from .nikola import Nikola
@@ -48,9 +49,14 @@
 
 
 def main(args):
+    quiet = False
     if len(args) > 0 and args[0] == 'build' and '--strict' in args:
         LOGGER.notice('Running in strict mode')
         STRICT_HANDLER.push_application()
+    if len(args) > 0 and args[0] == 'build' and '-q' in args or '--quiet' in args:
+        nullhandler = NullHandler()
+        nullhandler.push_application()
+        quiet = True
     global config
     sys.path.append('')
     try:
@@ -65,7 +71,7 @@
         config = {}
 
     site = Nikola(**config)
-    return DoitNikola(site).run(args)
+    return DoitNikola(site, quiet).run(args)
 
 
 class Help(DoitHelp):
@@ -97,6 +103,16 @@
                 'help': "Fail on things that would normally be warnings.",
             }
         )
+        opts.append(
+            {
+                'name': 'quiet',
+                'long': 'quiet',
+                'short': 'q',
+                'default': False,
+                'type': bool,
+                'help': "Run quietly.",
+            }
+        )
         self.cmd_options = tuple(opts)
         super(Build, self).__init__(*args, **kw)
 
@@ -114,14 +130,21 @@
 
 class NikolaTaskLoader(TaskLoader):
     """custom task loader to get tasks from Nikola instead of dodo.py file"""
-    def __init__(self, nikola):
+    def __init__(self, nikola, quiet=False):
         self.nikola = nikola
+        self.quiet = quiet
 
     def load_tasks(self, cmd, opt_values, pos_args):
-        DOIT_CONFIG = {
-            'reporter': ExecutedOnlyReporter,
-            'default_tasks': ['render_site', 'post_render'],
-        }
+        if self.quiet:
+            DOIT_CONFIG = {
+                'verbosity': 0,
+                'reporter': 'zero',
+            }
+        else:
+            DOIT_CONFIG = {
+                'reporter': ExecutedOnlyReporter,
+            }
+        DOIT_CONFIG['default_tasks'] = ['render_site', 'post_render']
         tasks = generate_tasks('render_site', self.nikola.gen_tasks('render_site', "Task"))
         latetasks = generate_tasks('post_render', self.nikola.gen_tasks('post_render', "LateTask"))
         return tasks + latetasks, DOIT_CONFIG
@@ -132,9 +155,9 @@
     DOIT_CMDS = list(DoitMain.DOIT_CMDS) + [Help, Build, Clean]
     TASK_LOADER = NikolaTaskLoader
 
-    def __init__(self, nikola):
+    def __init__(self, nikola, quiet=False):
         self.nikola = nikola
-        self.task_loader = self.TASK_LOADER(nikola)
+        self.task_loader = self.TASK_LOADER(nikola, quiet)
 
     def get_commands(self):
         # core doit commands

{"golden_diff": "diff --git a/nikola/main.py b/nikola/main.py\n--- a/nikola/main.py\n+++ b/nikola/main.py\n@@ -38,6 +38,7 @@\n from doit.cmd_help import Help as DoitHelp\n from doit.cmd_run import Run as DoitRun\n from doit.cmd_clean import Clean as DoitClean\n+from logbook import NullHandler\n \n from . import __version__\n from .nikola import Nikola\n@@ -48,9 +49,14 @@\n \n \n def main(args):\n+    quiet = False\n     if len(args) > 0 and args[0] == 'build' and '--strict' in args:\n         LOGGER.notice('Running in strict mode')\n         STRICT_HANDLER.push_application()\n+    if len(args) > 0 and args[0] == 'build' and '-q' in args or '--quiet' in args:\n+        nullhandler = NullHandler()\n+        nullhandler.push_application()\n+        quiet = True\n     global config\n     sys.path.append('')\n     try:\n@@ -65,7 +71,7 @@\n         config = {}\n \n     site = Nikola(**config)\n-    return DoitNikola(site).run(args)\n+    return DoitNikola(site, quiet).run(args)\n \n \n class Help(DoitHelp):\n@@ -97,6 +103,16 @@\n                 'help': \"Fail on things that would normally be warnings.\",\n             }\n         )\n+        opts.append(\n+            {\n+                'name': 'quiet',\n+                'long': 'quiet',\n+                'short': 'q',\n+                'default': False,\n+                'type': bool,\n+                'help': \"Run quietly.\",\n+            }\n+        )\n         self.cmd_options = tuple(opts)\n         super(Build, self).__init__(*args, **kw)\n \n@@ -114,14 +130,21 @@\n \n class NikolaTaskLoader(TaskLoader):\n     \"\"\"custom task loader to get tasks from Nikola instead of dodo.py file\"\"\"\n-    def __init__(self, nikola):\n+    def __init__(self, nikola, quiet=False):\n         self.nikola = nikola\n+        self.quiet = quiet\n \n     def load_tasks(self, cmd, opt_values, pos_args):\n-        DOIT_CONFIG = {\n-            'reporter': ExecutedOnlyReporter,\n-            'default_tasks': ['render_site', 'post_render'],\n-        }\n+        if self.quiet:\n+            DOIT_CONFIG = {\n+                'verbosity': 0,\n+                'reporter': 'zero',\n+            }\n+        else:\n+            DOIT_CONFIG = {\n+                'reporter': ExecutedOnlyReporter,\n+            }\n+        DOIT_CONFIG['default_tasks'] = ['render_site', 'post_render']\n         tasks = generate_tasks('render_site', self.nikola.gen_tasks('render_site', \"Task\"))\n         latetasks = generate_tasks('post_render', self.nikola.gen_tasks('post_render', \"LateTask\"))\n         return tasks + latetasks, DOIT_CONFIG\n@@ -132,9 +155,9 @@\n     DOIT_CMDS = list(DoitMain.DOIT_CMDS) + [Help, Build, Clean]\n     TASK_LOADER = NikolaTaskLoader\n \n-    def __init__(self, nikola):\n+    def __init__(self, nikola, quiet=False):\n         self.nikola = nikola\n-        self.task_loader = self.TASK_LOADER(nikola)\n+        self.task_loader = self.TASK_LOADER(nikola, quiet)\n \n     def get_commands(self):\n         # core doit commands\n", "issue": "Nikola needs a -q (quiet) switch for testing and other automated tasks\nJust needs to hide NOTICEs\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\n# Copyright \u00a9 2012-2013 Roberto Alsina and others.\n\n# Permission is hereby granted, free of charge, to any\n# person obtaining a copy of this software and associated\n# documentation files (the \"Software\"), to deal in the\n# Software without restriction, including without limitation\n# the rights to use, copy, modify, merge, publish,\n# distribute, sublicense, and/or sell copies of the\n# Software, and to permit persons to whom the Software is\n# furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice\n# shall be included in all copies or substantial portions of\n# the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY\n# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE\n# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR\n# PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\n# OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR\n# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nfrom __future__ import print_function, unicode_literals\nfrom operator import attrgetter\nimport os\nimport shutil\nimport sys\nimport traceback\n\nfrom doit.loader import generate_tasks\nfrom doit.cmd_base import TaskLoader\nfrom doit.reporter import ExecutedOnlyReporter\nfrom doit.doit_cmd import DoitMain\nfrom doit.cmd_help import Help as DoitHelp\nfrom doit.cmd_run import Run as DoitRun\nfrom doit.cmd_clean import Clean as DoitClean\n\nfrom . import __version__\nfrom .nikola import Nikola\nfrom .utils import _reload, sys_decode, LOGGER, STRICT_HANDLER\n\n\nconfig = {}\n\n\ndef main(args):\n    if len(args) > 0 and args[0] == 'build' and '--strict' in args:\n        LOGGER.notice('Running in strict mode')\n        STRICT_HANDLER.push_application()\n    global config\n    sys.path.append('')\n    try:\n        import conf\n        _reload(conf)\n        config = conf.__dict__\n    except Exception:\n        if os.path.exists('conf.py'):\n            msg = traceback.format_exc(0).splitlines()[1]\n            LOGGER.error('In conf.py line {0}: {1}'.format(sys.exc_info()[2].tb_lineno, msg))\n            sys.exit(1)\n        config = {}\n\n    site = Nikola(**config)\n    return DoitNikola(site).run(args)\n\n\nclass Help(DoitHelp):\n    \"\"\"show Nikola usage instead of doit \"\"\"\n\n    @staticmethod\n    def print_usage(cmds):\n        \"\"\"print nikola \"usage\" (basic help) instructions\"\"\"\n        print(\"Nikola is a tool to create static websites and blogs. For full documentation and more information, please visit http://getnikola.com\\n\\n\")\n        print(\"Available commands:\")\n        for cmd in sorted(cmds.values(), key=attrgetter('name')):\n            print(\"  nikola %-*s %s\" % (20, cmd.name, cmd.doc_purpose))\n        print(\"\")\n        print(\"  nikola help                 show help / reference\")\n        print(\"  nikola help <command>       show command usage\")\n        print(\"  nikola help <task-name>     show task usage\")\n\n\nclass Build(DoitRun):\n    \"\"\"expose \"run\" command as \"build\" for backward compatibility\"\"\"\n    def __init__(self, *args, **kw):\n        opts = list(self.cmd_options)\n        opts.append(\n            {\n                'name': 'strict',\n                'long': 'strict',\n                'default': False,\n                'type': bool,\n                'help': \"Fail on things that would normally be warnings.\",\n            }\n        )\n        self.cmd_options = tuple(opts)\n        super(Build, self).__init__(*args, **kw)\n\n\nclass Clean(DoitClean):\n    \"\"\"A clean that removes cache/\"\"\"\n\n    def clean_tasks(self, tasks, dryrun):\n        if not dryrun and config:\n            cache_folder = config.get('CACHE_FOLDER', 'cache')\n            if os.path.exists(cache_folder):\n                shutil.rmtree(cache_folder)\n        return super(Clean, self).clean_tasks(tasks, dryrun)\n\n\nclass NikolaTaskLoader(TaskLoader):\n    \"\"\"custom task loader to get tasks from Nikola instead of dodo.py file\"\"\"\n    def __init__(self, nikola):\n        self.nikola = nikola\n\n    def load_tasks(self, cmd, opt_values, pos_args):\n        DOIT_CONFIG = {\n            'reporter': ExecutedOnlyReporter,\n            'default_tasks': ['render_site', 'post_render'],\n        }\n        tasks = generate_tasks('render_site', self.nikola.gen_tasks('render_site', \"Task\"))\n        latetasks = generate_tasks('post_render', self.nikola.gen_tasks('post_render', \"LateTask\"))\n        return tasks + latetasks, DOIT_CONFIG\n\n\nclass DoitNikola(DoitMain):\n    # overwite help command\n    DOIT_CMDS = list(DoitMain.DOIT_CMDS) + [Help, Build, Clean]\n    TASK_LOADER = NikolaTaskLoader\n\n    def __init__(self, nikola):\n        self.nikola = nikola\n        self.task_loader = self.TASK_LOADER(nikola)\n\n    def get_commands(self):\n        # core doit commands\n        cmds = DoitMain.get_commands(self)\n        # load nikola commands\n        for name, cmd in self.nikola.commands.items():\n            cmds[name] = cmd\n        return cmds\n\n    def run(self, cmd_args):\n        sub_cmds = self.get_commands()\n        args = self.process_args(cmd_args)\n        args = [sys_decode(arg) for arg in args]\n\n        if len(args) == 0 or any(arg in [\"--help\", '-h'] for arg in args):\n            cmd_args = ['help']\n            args = ['help']\n            # Hide run because Nikola uses build\n            sub_cmds.pop('run')\n\n        if len(args) == 0 or args[0] not in sub_cmds.keys() or \\\n                args[0] == 'build':\n            # Check for conf.py before launching run\n            if not self.nikola.configured:\n                LOGGER.error(\"This command needs to run inside an \"\n                             \"existing Nikola site.\")\n                return False\n        return super(DoitNikola, self).run(cmd_args)\n\n    @staticmethod\n    def print_version():\n        print(\"Nikola version \" + __version__)\n", "path": "nikola/main.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n\n# Copyright \u00a9 2012-2013 Roberto Alsina and others.\n\n# Permission is hereby granted, free of charge, to any\n# person obtaining a copy of this software and associated\n# documentation files (the \"Software\"), to deal in the\n# Software without restriction, including without limitation\n# the rights to use, copy, modify, merge, publish,\n# distribute, sublicense, and/or sell copies of the\n# Software, and to permit persons to whom the Software is\n# furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice\n# shall be included in all copies or substantial portions of\n# the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY\n# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE\n# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR\n# PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\n# OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR\n# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nfrom __future__ import print_function, unicode_literals\nfrom operator import attrgetter\nimport os\nimport shutil\nimport sys\nimport traceback\n\nfrom doit.loader import generate_tasks\nfrom doit.cmd_base import TaskLoader\nfrom doit.reporter import ExecutedOnlyReporter\nfrom doit.doit_cmd import DoitMain\nfrom doit.cmd_help import Help as DoitHelp\nfrom doit.cmd_run import Run as DoitRun\nfrom doit.cmd_clean import Clean as DoitClean\nfrom logbook import NullHandler\n\nfrom . import __version__\nfrom .nikola import Nikola\nfrom .utils import _reload, sys_decode, LOGGER, STRICT_HANDLER\n\n\nconfig = {}\n\n\ndef main(args):\n    quiet = False\n    if len(args) > 0 and args[0] == 'build' and '--strict' in args:\n        LOGGER.notice('Running in strict mode')\n        STRICT_HANDLER.push_application()\n    if len(args) > 0 and args[0] == 'build' and '-q' in args or '--quiet' in args:\n        nullhandler = NullHandler()\n        nullhandler.push_application()\n        quiet = True\n    global config\n    sys.path.append('')\n    try:\n        import conf\n        _reload(conf)\n        config = conf.__dict__\n    except Exception:\n        if os.path.exists('conf.py'):\n            msg = traceback.format_exc(0).splitlines()[1]\n            LOGGER.error('In conf.py line {0}: {1}'.format(sys.exc_info()[2].tb_lineno, msg))\n            sys.exit(1)\n        config = {}\n\n    site = Nikola(**config)\n    return DoitNikola(site, quiet).run(args)\n\n\nclass Help(DoitHelp):\n    \"\"\"show Nikola usage instead of doit \"\"\"\n\n    @staticmethod\n    def print_usage(cmds):\n        \"\"\"print nikola \"usage\" (basic help) instructions\"\"\"\n        print(\"Nikola is a tool to create static websites and blogs. For full documentation and more information, please visit http://getnikola.com\\n\\n\")\n        print(\"Available commands:\")\n        for cmd in sorted(cmds.values(), key=attrgetter('name')):\n            print(\"  nikola %-*s %s\" % (20, cmd.name, cmd.doc_purpose))\n        print(\"\")\n        print(\"  nikola help                 show help / reference\")\n        print(\"  nikola help <command>       show command usage\")\n        print(\"  nikola help <task-name>     show task usage\")\n\n\nclass Build(DoitRun):\n    \"\"\"expose \"run\" command as \"build\" for backward compatibility\"\"\"\n    def __init__(self, *args, **kw):\n        opts = list(self.cmd_options)\n        opts.append(\n            {\n                'name': 'strict',\n                'long': 'strict',\n                'default': False,\n                'type': bool,\n                'help': \"Fail on things that would normally be warnings.\",\n            }\n        )\n        opts.append(\n            {\n                'name': 'quiet',\n                'long': 'quiet',\n                'short': 'q',\n                'default': False,\n                'type': bool,\n                'help': \"Run quietly.\",\n            }\n        )\n        self.cmd_options = tuple(opts)\n        super(Build, self).__init__(*args, **kw)\n\n\nclass Clean(DoitClean):\n    \"\"\"A clean that removes cache/\"\"\"\n\n    def clean_tasks(self, tasks, dryrun):\n        if not dryrun and config:\n            cache_folder = config.get('CACHE_FOLDER', 'cache')\n            if os.path.exists(cache_folder):\n                shutil.rmtree(cache_folder)\n        return super(Clean, self).clean_tasks(tasks, dryrun)\n\n\nclass NikolaTaskLoader(TaskLoader):\n    \"\"\"custom task loader to get tasks from Nikola instead of dodo.py file\"\"\"\n    def __init__(self, nikola, quiet=False):\n        self.nikola = nikola\n        self.quiet = quiet\n\n    def load_tasks(self, cmd, opt_values, pos_args):\n        if self.quiet:\n            DOIT_CONFIG = {\n                'verbosity': 0,\n                'reporter': 'zero',\n            }\n        else:\n            DOIT_CONFIG = {\n                'reporter': ExecutedOnlyReporter,\n            }\n        DOIT_CONFIG['default_tasks'] = ['render_site', 'post_render']\n        tasks = generate_tasks('render_site', self.nikola.gen_tasks('render_site', \"Task\"))\n        latetasks = generate_tasks('post_render', self.nikola.gen_tasks('post_render', \"LateTask\"))\n        return tasks + latetasks, DOIT_CONFIG\n\n\nclass DoitNikola(DoitMain):\n    # overwite help command\n    DOIT_CMDS = list(DoitMain.DOIT_CMDS) + [Help, Build, Clean]\n    TASK_LOADER = NikolaTaskLoader\n\n    def __init__(self, nikola, quiet=False):\n        self.nikola = nikola\n        self.task_loader = self.TASK_LOADER(nikola, quiet)\n\n    def get_commands(self):\n        # core doit commands\n        cmds = DoitMain.get_commands(self)\n        # load nikola commands\n        for name, cmd in self.nikola.commands.items():\n            cmds[name] = cmd\n        return cmds\n\n    def run(self, cmd_args):\n        sub_cmds = self.get_commands()\n        args = self.process_args(cmd_args)\n        args = [sys_decode(arg) for arg in args]\n\n        if len(args) == 0 or any(arg in [\"--help\", '-h'] for arg in args):\n            cmd_args = ['help']\n            args = ['help']\n            # Hide run because Nikola uses build\n            sub_cmds.pop('run')\n\n        if len(args) == 0 or args[0] not in sub_cmds.keys() or \\\n                args[0] == 'build':\n            # Check for conf.py before launching run\n            if not self.nikola.configured:\n                LOGGER.error(\"This command needs to run inside an \"\n                             \"existing Nikola site.\")\n                return False\n        return super(DoitNikola, self).run(cmd_args)\n\n    @staticmethod\n    def print_version():\n        print(\"Nikola version \" + __version__)\n", "path": "nikola/main.py"}]}