示例#1
0
def new(repo: str = typer.Option(Path.cwd().parts[-1], prompt="Repo name")):
    user = '******'
    pwd = os.environ['ENV_GTH']

    s = f'curl -i -H "Authorization: token {pwd}"'
    s += " -d '{"
    s += f'"name": "{repo}",'
    # s += '"auto_init": true,'
    s += '"private": true'
    s += f"}}' https://api.github.com/{user}/repos"

    console.print(s)

    s = f'curl -i -H "Authorization: token {pwd}"'
    s += " -d '{"
    s += f'"name": "{repo}",'
    # s += '"auto_init": true,'
    s += '"private": true'
    s += f"}}' https://api.github.com/user/repos"

    if True:
        repo_name = dict(name=repo)
        cmds = []
        cmds.append('git init')
        cmds.append(s)
        # cmds.append('curl -u \'' + usr + '\' https://api.github.com/user/repos -d \'{"name" : "' + repo + '"}\'')
        cmds.append(f'git remote add origin [email protected]:ab22375/{repo}.git')
        cmds.append('git add .')
        cmds.append('git commit -m "first commit"')
        cmds.append('git push --set-upstream origin master')
        for cmd in cmds:
            console.print(cmd)
示例#2
0
def new(repo: str = typer.Option(Path.cwd().parts[-1], prompt="Repo name")):
    user = '******'
    pwd = os.environ['ENV_GTH']

    s = """
        curl -i -H Authorization: token {pwd}
        -d '{
            "name": "monthly_report",
            "auto_init": true,
            "private": true
        }' 
        https://api.github.com/{user}/repos
    """.format(pwd=pwd, user=user)

    console.print(s)
    # console.print(Path.cwd())
    if False:
        repo_name = dict(name=repo)
        cmds = []
        cmds.append('git init')
        cmds.append('curl -u \'' + usr +
                    '\' https://api.github.com/user/repos -d \'{"name" : "' +
                    repo + '"}\'')
        cmds.append(f'git remote add origin [email protected]:ab22375/{repo}.git')
        cmds.append('git add .')
        cmds.append('git commit -m "first commit"')
        cmds.append('git push --set-upstream origin master')
        for cmd in cmds:
            console.print(cmd)
示例#3
0
def new(repo: str = typer.Option(Path.cwd().parts[-1], prompt="Repo name")):
    usr = '******'
    pwd = '57a361e49a3a8d12a7a73c6d8d79cf70c3da0425'
    repo_name = dict(name=repo)
    cmds = []
    cmds.append('git init')
    cmds.append(
        'curl -u {usr}:{pwd} https://api.github.com/user/repos -d \'{"name" : "'
        + repo + '"}\'')
    cmds.append(f'git remote add origin [email protected]:ab22375/{repo}.git')
    cmds.append('git add .')
    cmds.append('git commit -m "first commit"')
    cmds.append('git push --set-upstream origin master')
    for cmd in cmds:
        console.print(cmd)
示例#4
0
def add(comment: str = typer.Option('upd', prompt="Comment: ")):

    cmds = []
    cmds.append("git add .")
    cmds.append(f'git commit -m "{comment}" ')
    cmds.append("git push")

    for cmd in cmds:
        typer.echo(cmd)
        try:
            check_output(cmd, shell=True, cwd="./")  #, cwd=folder)
        except:
            console.print('-' * 30, '\n\n   ==>> Error\n\n', '-' * 30)

    console.print('*** END ***')
示例#5
0
def new(repo: str = typer.Option(Path.cwd().parts[-1], prompt="Repo name")):
    # console.print(Path.cwd())
    if True:
        usr = '******'
        pwd = os.environ['ENV_GTH']
        repo_name = dict(name=repo)
        cmds = []
        cmds.append('git init')
        cmds.append('curl -u \'' + usr +
                    '\' https://api.github.com/user/repos -d \'{"name" : "' +
                    repo + '"}\'')
        cmds.append(f'git remote add origin [email protected]:ab22375/{repo}.git')
        cmds.append('git add .')
        cmds.append('git commit -m "first commit"')
        cmds.append('git push --set-upstream origin master')
        for cmd in cmds:
            console.print(cmd)
示例#6
0
def new(
):
    console.print(Path.parts)
    pass
示例#7
0
      https://api.github.com/{user}/repos
    """.format(pwd=pwd, user=user)
    
    
    # console.print(Path.cwd())
    if True:
        repo_name = dict(name=repo)
        cmds = []
        cmds.append('git init')
        cmds.append('curl -u \'' + usr + '\' https://api.github.com/user/repos -d \'{"name" : "' + repo + '"}\'')
        cmds.append(f'git remote add origin [email protected]:ab22375/{repo}.git')
        cmds.append('git add .')
        cmds.append('git commit -m "first commit"')
        cmds.append('git push --set-upstream origin master')
        for cmd in cmds:
            console.print(cmd)
            # check_output(cmd, shell=True, cwd=Path.cwd())

# - - - -  - - - -  - - - -  - - - -  - - - -  - - - - 
@app.command()
def add(
    comment: str = typer.Option('upd', prompt="Comment: ")
    ):

    cmds = []
    cmds.append("git add .")
    cmds.append(f'git commit -m "{comment}" ')
    cmds.append("git push")

    for cmd in cmds:
        typer.echo(cmd)
示例#8
0
def new():
    console.print(Path.cwd().parts[-1])
    pass
示例#9
0
def new(
    repo:str = typer.Option('new-project', prompt="Repository name"),
    packages:str=typer.Option('', prompt="list of packages separated by space")
):
    console.print(Path.parent)
    pass
示例#10
0
def new(repo: str = typer.Option(Path.cwd().parts[-1], prompt="Repo name")):

    console.print(repo)
    pass
示例#11
0
def new(
    repo:str = typer.Option(Path.cwd().parts[-1], prompt="Repo name")
):

    usr = '******'
	pwd = '57a361e49a3a8d12a7a73c6d8d79cf70c3da0425'
    
    cmds = []
    cmds.append('git init')
    cmds.append(f'curl -u {usr}:{pwd} https://api.github.com/user/repos -d {"name":"{repo}"}')
    cmds.append(f'git remote add origin [email protected]:ab22375/{repo}.git')
    cmds.append('git add .')
    cmds.append('git commit -m "first commit"')
    cmds.append('git push --set-upstream origin master')
    for cmd in cmds:
        console.print(cmd)
        check_output(cmd, shell=True, cwd=Path.cwd())
    
    
    

    console.print(repo)
    pass

# - - - - - - - - - - - - - - - - - - - - - - - - 
if __name__ == "__main__":
    app()


function gitnew(){
}
示例#12
0
def main():
    console.print("***")
    typer.echo("***")