Exemplo n.º 1
0
import time
import urllib.request
import argparse
import os
from ghlicense import repobase
from ghlicense import providers

enhanced_description = """
This script scans every repo of the specified user for a license
file. If a license can't be found, the script will upload a
a specified license to your repo. Choose a license on
http://choosealicense.com/licenses/ or use http://www.addalicense.com/.
Remember, without a license file, your project is proprietary!
"""

enabled_providers, disabled_providers = repobase.get_providers()

parser = argparse.ArgumentParser(
    description="GitHub License checker and downloader",
    epilog=enhanced_description)
err_providers_txt = "(errored providers: %s)" % ", ".join(
    disabled_providers) if len(disabled_providers) > 0 else ""
parser.add_argument(
    "--provider",
    help="Repository provider. Defaults to github. Available providers: %s %s"
    % (", ".join(enabled_providers), err_providers_txt),
    action="store",
    default="github")
parser.add_argument(
    "--scan",
    help=
Exemplo n.º 2
0
from configparser import ConfigParser

from ghlicense import repobase
from ghlicense.providers import *

ENHANCED_DESCRIPTION = """
    This script scans every repo of the specified user for a license
    file. If a license can't be found, the script will upload a
    a specified license to your repo.\n
    Choose a license on http://choosealicense.com/licenses/ or use
    http://www.addalicense.com/.\n
    Remember, without a license file, your project is proprietary!
"""

# Load all the providers
ENABLED_PROVIDERS, DISABLED_PROVIDERS = repobase.get_providers()

# Parse the cmdline and initialise args
PARSER = ArgumentParser(
    description="GitHosting License checker and downloader",
    epilog=ENHANCED_DESCRIPTION,
    formatter_class=RawTextHelpFormatter)

ERR_PROVIDERS_TXT = "(errored providers: %s)" % ", ".join(
    DISABLED_PROVIDERS) if DISABLED_PROVIDERS else ""

PARSER.add_argument("--scan",
                    help="Scan repo of the user, arguments: [User_nick]",
                    action="store")
PARSER.add_argument("--license",
                    help="Download a license file, arguments: [License_name]",
Exemplo n.º 3
0
import argparse
import os
from ghlicense import repobase
from ghlicense import providers
from argparse import RawTextHelpFormatter

enhanced_description = """
This script scans every repo of the specified user for a license
file. If a license can't be found, the script will upload a
a specified license to your repo.\n
Choose a license on http://choosealicense.com/licenses/ or use 
http://www.addalicense.com/.\n
Remember, without a license file, your project is proprietary!
"""
# Load all the providers
enabled_providers, disabled_providers = repobase.get_providers()
# Set all the  argument
parser = argparse.ArgumentParser(description = "GitHosting License checker and downloader",
    epilog = enhanced_description, formatter_class=RawTextHelpFormatter)
err_providers_txt = "(errored providers: %s)" % ", ".join(disabled_providers) if len(disabled_providers) > 0 else ""
parser.add_argument("--scan", help="Scan repo of the user, arguments: [User_nick]", action="store")
parser.add_argument("--license", help="Download a license file, arguments: [License_name]", action="store")
parser.add_argument("--licenselist", help="Show licenses available", action="store_true")
parser.add_argument("--provider", help="Repository provider. Defaults to github. Available providers: %s %s" % 
    (", ".join(enabled_providers), err_providers_txt), action="store", default="github")
parser.add_argument("--report", help="The report filename for scan (optional)", action="store")
parser.add_argument("--origin", help="The origin of the git repo (optional)", action="store")
parser.add_argument('args', nargs=argparse.REMAINDER)
args = parser.parse_args()
# In case of not parameter show the help
if len(sys.argv) < 2: