mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
parent
9e526a825e
commit
e81a284c39
2 changed files with 31 additions and 4 deletions
|
|
@ -11,6 +11,7 @@ import re
|
|||
import sys
|
||||
import time
|
||||
import traceback
|
||||
from pprint import pprint
|
||||
|
||||
import six
|
||||
|
||||
|
|
@ -319,6 +320,12 @@ def parse_arguments():
|
|||
help='Relaunch pelican each time a modification occurs'
|
||||
' on the content files.')
|
||||
|
||||
parser.add_argument('--print-settings', dest='print_settings',
|
||||
action='append', nargs='?', metavar='SETTING_NAME',
|
||||
help='Print current configuration settings and exit. '
|
||||
'Append a setting name as argument to see the value '
|
||||
'for that specific setting only.')
|
||||
|
||||
parser.add_argument('--relative-urls', dest='relative_paths',
|
||||
action='store_true',
|
||||
help='Use relative urls in output, '
|
||||
|
|
@ -527,6 +534,21 @@ def main():
|
|||
|
||||
try:
|
||||
pelican, settings = get_instance(args)
|
||||
|
||||
if args.print_settings:
|
||||
# If no argument was given to --print-settings, print all settings
|
||||
if args.print_settings[0] is None:
|
||||
pprint(settings)
|
||||
# An argument was given to --print-settings, so print that setting
|
||||
else:
|
||||
try:
|
||||
pprint(settings[args.print_settings[0]])
|
||||
except KeyError:
|
||||
print("{} is not a recognized setting.".format(
|
||||
args.print_settings[0]))
|
||||
return 1
|
||||
return 0
|
||||
|
||||
readers = Readers(settings)
|
||||
reader_descs = sorted(set(['%s (%s)' %
|
||||
(type(r).__name__,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue