Exemple #1
0
def main(readme_variant, print_, name, description, fullname, nickname,
         license):
    app_data_paths = AppDataPaths(app_name='readme',
                                  root_appdata='.opensource',
                                  with_dot=False)
    if app_data_paths.require_setup():
        app_data_paths.setup()

    readmes_folder = app_data_paths.join('reamdes')
    if not os.path.exists(readmes_folder):
        os.makedirs(readmes_folder)

    manager = ReadmeManager(readmes_folder=readmes_folder)
    try:
        readme_content = manager.get(readme_variant,
                                     project_name=name,
                                     project_description=description,
                                     author_fullname=fullname,
                                     author_nickname=nickname,
                                     license_name=license)
    except FileNotFoundError:
        logger.error('Cannot find the specified readme.')
        exit(-1)
    if print_:
        print(readme_content)
    else:
        with open('./README.md', 'w+') as f:
            f.write(readme_content)
Exemple #2
0
def main(license_name, print_):
    app_data_paths = AppDataPaths(app_name='license',
                                  root_appdata='.opensource',
                                  with_dot=False)
    if app_data_paths.require_setup():
        app_data_paths.setup()

    licenses_folder = app_data_paths.join('licenses')
    if not os.path.exists(licenses_folder):
        os.makedirs(licenses_folder)

    manager = LicenseManager(licenses_folder=licenses_folder)
    try:
        license_content = manager.get(license_name)
    except FileNotFoundError:
        logger.error('Cannot find the specified license.')
        exit(-1)
    if print_:
        print(license_content)
    else:
        with open('./LICENSE.md', 'w+') as f:
            f.write(license_content)