Skip to content

Commit

Permalink
Support passing --db-file and --backend to nikola auto (#3520)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kwpolska committed Mar 6, 2021
2 parents ad8716d + 31477bd commit bffa847
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Features
Bugfixes
--------

* Support passing ``--backend`` and ``--db-file`` to ``nikola auto``
* Typogrify ignores ``div`` elements with ``.math`` CSS class.
(Issue #3512)

Expand Down
26 changes: 24 additions & 2 deletions nikola/plugins/command/auto/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,34 @@ class CommandAuto(Command):
'long': 'process',
'default': 0,
'type': int,
'help': 'Number of subprocesses (nikola build argument)'
'help': 'Number of subprocesses',
'section': 'Arguments passed to `nikola build`'
},
{
'name': 'parallel-type',
'short': 'P',
'long': 'parallel-type',
'default': 'process',
'type': str,
'help': "Parallelization mode ('process' or 'thread', nikola build argument)"
'help': "Parallelization mode ('process' or 'thread')",
'section': 'Arguments passed to `nikola build`'
},
{
'name': 'db-file',
'long': 'db-file',
'default': '.doit.db',
'type': str,
'help': 'Database file',
'section': 'Arguments passed to `nikola build`'
},
{
'name': 'backend',
'long': 'backend',
'default': 'dbm',
'type': str,
'help': "Database backend ('dbm', 'json', 'sqlite3')",
'section': 'Arguments passed to `nikola build`'
}
]

def _execute(self, options, args):
Expand Down Expand Up @@ -164,6 +182,10 @@ def _execute(self, options, args):
self.nikola_cmd += ['--process={}'.format(options['process']),
'--parallel-type={}'.format(options['parallel-type'])]

if options:
self.nikola_cmd += ['--db-file={}'.format(options['db-file']),
'--backend={}'.format(options['backend'])]

port = options and options.get('port')
self.snippet = '''<script>document.write('<script src="http://'
+ (location.host || 'localhost').split(':')[0]
Expand Down

0 comments on commit bffa847

Please sign in to comment.