mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
- remove default=None with argparse is redundant since it's the
default value already. - use the argparse.ArgumentDefaultsHelpFormatter as the formatter_class, to print out automatically the default values
This commit is contained in:
parent
71a5ba3283
commit
4bac1ee745
3 changed files with 13 additions and 9 deletions
|
|
@ -135,7 +135,8 @@ class Pelican(object):
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(description="""A tool to generate a
|
parser = argparse.ArgumentParser(description="""A tool to generate a
|
||||||
static blog, with restructured text input files.""")
|
static blog, with restructured text input files.""",
|
||||||
|
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
||||||
|
|
||||||
parser.add_argument(dest='path', nargs='?',
|
parser.add_argument(dest='path', nargs='?',
|
||||||
help='Path where to find the content files.')
|
help='Path where to find the content files.')
|
||||||
|
|
@ -145,11 +146,11 @@ def main():
|
||||||
parser.add_argument('-o', '--output', dest='output',
|
parser.add_argument('-o', '--output', dest='output',
|
||||||
help='Where to output the generated files. If not specified, a '
|
help='Where to output the generated files. If not specified, a '
|
||||||
'directory will be created, named "output" in the current path.')
|
'directory will be created, named "output" in the current path.')
|
||||||
parser.add_argument('-m', '--markup', default=None, dest='markup',
|
parser.add_argument('-m', '--markup', dest='markup',
|
||||||
help='The list of markup language to use (rst or md). Please indicate '
|
help='The list of markup language to use (rst or md). Please indicate '
|
||||||
'them separated by commas.')
|
'them separated by commas.')
|
||||||
parser.add_argument('-s', '--settings', dest='settings', default='',
|
parser.add_argument('-s', '--settings', dest='settings',
|
||||||
help='The settings of the application. Default to False.')
|
help='The settings of the application.')
|
||||||
parser.add_argument('-d', '--delete-output-directory',
|
parser.add_argument('-d', '--delete-output-directory',
|
||||||
dest='delete_outputdir',
|
dest='delete_outputdir',
|
||||||
action='store_true', help='Delete the output directory.')
|
action='store_true', help='Delete the output directory.')
|
||||||
|
|
|
||||||
|
|
@ -234,7 +234,8 @@ def fields2pelican(fields, out_markup, output_path, dircat=False):
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description="Transform feed, Wordpress or Dotclear files to rst files."
|
description="Transform feed, Wordpress or Dotclear files to rst files."
|
||||||
"Be sure to have pandoc installed")
|
"Be sure to have pandoc installed",
|
||||||
|
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
||||||
|
|
||||||
parser.add_argument(dest='input', help='The input file to read')
|
parser.add_argument(dest='input', help='The input file to read')
|
||||||
parser.add_argument('--wpfile', action='store_true', dest='wpfile',
|
parser.add_argument('--wpfile', action='store_true', dest='wpfile',
|
||||||
|
|
|
||||||
|
|
@ -193,14 +193,16 @@ def ask(question, answer=str, default=None, l=None):
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(description="A kickstarter for pelican")
|
parser = argparse.ArgumentParser(
|
||||||
|
description="A kickstarter for pelican",
|
||||||
|
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
||||||
parser.add_argument('-p', '--path', default=".",
|
parser.add_argument('-p', '--path', default=".",
|
||||||
help="The path to generate the blog into")
|
help="The path to generate the blog into")
|
||||||
parser.add_argument('-t', '--title', default=None, metavar="title",
|
parser.add_argument('-t', '--title', metavar="title",
|
||||||
help='Set the title of the website')
|
help='Set the title of the website')
|
||||||
parser.add_argument('-a', '--author', default=None, metavar="author",
|
parser.add_argument('-a', '--author', metavar="author",
|
||||||
help='Set the author name of the website')
|
help='Set the author name of the website')
|
||||||
parser.add_argument('-l', '--lang', default=None, metavar="lang",
|
parser.add_argument('-l', '--lang', metavar="lang",
|
||||||
help='Set the default lang of the website')
|
help='Set the default lang of the website')
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue