38 lines
505 B
Python
38 lines
505 B
Python
import os
|
|
import sys
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
readme = Path('README.md')
|
|
setup = Path('setup.cfg')
|
|
|
|
|
|
def main(args):
|
|
try:
|
|
name = args[1]
|
|
|
|
except IndexError:
|
|
print('Missing name')
|
|
return 1
|
|
|
|
try:
|
|
description = ' '.join(args[2:])
|
|
|
|
except IndexError:
|
|
print('Missing description')
|
|
return 1
|
|
|
|
for file in {readme, setup}:
|
|
file.write_text(file.read_text().format(
|
|
name = name,
|
|
description = description or 'na'
|
|
))
|
|
|
|
Path('generate.py').unlink()
|
|
|
|
return 0
|
|
|
|
|
|
sys.exit(main(sys.argv))
|