mirror of
https://github.com/venthur/blag.git
synced 2025-11-25 20:52:43 +00:00
Added quickstart
This commit is contained in:
22
blag/blag.py
22
blag/blag.py
@@ -67,6 +67,10 @@ def parse_args(args):
|
||||
default='templates',
|
||||
help='Template directory (default: templates)',
|
||||
)
|
||||
|
||||
quickstart_parser = commands.add_parser('quickstart')
|
||||
quickstart_parser.set_defaults(func=quickstart)
|
||||
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
@@ -233,5 +237,23 @@ def generate_archive(articles, template, output_dir):
|
||||
fh.write(result)
|
||||
|
||||
|
||||
def quickstart(args):
|
||||
base_url = input("Hostname (and path) to the root? "
|
||||
"[https://example.com/]: ")
|
||||
title = input("Title of your website? ")
|
||||
subtitle = input("Subtitle of your website? ")
|
||||
author = input("Author of your website [John Doe]? ")
|
||||
|
||||
config = configparser.ConfigParser()
|
||||
config['main'] = {
|
||||
'base_url': base_url,
|
||||
'title': title,
|
||||
'subtitle': subtitle,
|
||||
'author': author,
|
||||
}
|
||||
with open('config.ini', 'w') as fh:
|
||||
config.write(fh)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user