Created
September 13, 2018 19:18
-
-
Save skatesham/467a48adf70c41581b8633f35c267e7f to your computer and use it in GitHub Desktop.
Script Set Up Github with Python3 in command line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/python | |
import subprocess | |
print("---------------------------------------------------") | |
print("Automatic Watched Set Up of Github in Python") | |
print("-----------by Sham Vinicius Fiorin-----------------") | |
print("---------------------------------------------------") | |
config = input("Set up configurations[N/s]?") | |
if('s' in config.lower()): | |
subprocess.run(["git", "init"]) | |
nome = input("Insert username: ") | |
subprocess.run(["git","config","--global", "user.name",nome]) | |
subprocess.run(["git","config","--global", "user.name"]) | |
email = input("Insert email: ") | |
subprocess.run(["git","config","--global", "user.email",email]) | |
subprocess.run(["git","config","--global", "user.name"]) | |
remote = input("insert url remote: ") | |
subprocess.run(["git", "remote", "add", "origin", remote]) | |
subprocess.run(["git", "remote", "set-url", "origin", remote]) | |
subprocess.run(["git", "remote", "-v"]) | |
else: | |
condition = 0; | |
while(condition != 5): | |
print("----Options----") | |
print("1: pull a branch") | |
print("2: push a branch") | |
print("3: create branch") | |
print("4: checkout branch") | |
print("5: exit") | |
condition = int(input("Insert one option: ")) | |
if(condition == 1): | |
branch = input("Insert branch to pull: ") | |
subprocess.run(['git', 'pull', 'origin', branch]) | |
if(condition == 2): | |
print("--- Pushing All ---") | |
subprocess.run(['git', 'add', "."]) | |
branch = input("Insert branch to push: ") | |
commit = input("Insert the commit") | |
subprocess.run(['git', 'commit', '-m', commit]) | |
subprocess.run(['git', 'push', 'origin', branch]) | |
if(condition == 3): | |
branch = input("Insert a name to the branch: ") | |
subprocess.run(['git', 'branch', branch]) | |
if(condition == 4): | |
branch = input("Insert the branch name: ") | |
subprocess.run(['git', 'checkout', branch]) | |
print("Thanks for using the script S2"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment