MCPcopy
hub / github.com/getpelican/pelican / main

Function main

pelican/tools/pelican_quickstart.py:186–397  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

184
185
186def main():
187 parser = argparse.ArgumentParser(
188 description="A kickstarter for Pelican",
189 formatter_class=argparse.ArgumentDefaultsHelpFormatter,
190 )
191 parser.add_argument(
192 "-p", "--path", default=_DEFAULT_PATH, help="The path to generate the blog into"
193 )
194 parser.add_argument(
195 "-t", "--title", metavar="title", help="Set the title of the website"
196 )
197 parser.add_argument(
198 "-a", "--author", metavar="author", help="Set the author name of the website"
199 )
200 parser.add_argument(
201 "-l", "--lang", metavar="lang", help="Set the default web site language"
202 )
203
204 args = parser.parse_args()
205
206 print(
207 f"""Welcome to pelican-quickstart v{__version__}.
208
209This script will help you create a new Pelican-based website.
210
211Please answer the following questions so this script can generate the files
212needed by Pelican.
213
214 """
215 )
216
217 project = os.path.join(os.environ.get("VIRTUAL_ENV", os.curdir), ".project")
218 no_path_was_specified = hasattr(args.path, "is_default_path")
219 if os.path.isfile(project) and no_path_was_specified:
220 CONF["basedir"] = open(project).read().rstrip("\n")
221 print(
222 "Using project associated with current virtual environment. "
223 "Will save to:\n{}\n".format(CONF["basedir"])
224 )
225 else:
226 CONF["basedir"] = os.path.abspath(
227 os.path.expanduser(
228 ask(
229 "Where do you want to create your new web site?",
230 answer=str,
231 default=args.path,
232 )
233 )
234 )
235
236 CONF["sitename"] = ask(
237 "What will be the title of this web site?", answer=str, default=args.title
238 )
239 CONF["author"] = ask(
240 "Who will be the author of this web site?", answer=str, default=args.author
241 )
242 CONF["lang"] = ask(
243 "What will be the default language of this web site?",

Callers 1

Calls 5

askFunction · 0.85
ask_timezoneFunction · 0.85
render_jinja_templateFunction · 0.85
getMethod · 0.80
readMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…