├── readme.md
├── wesbite
└── public
│ ├── CLEAN
│ └── Setup Shift.png
├── CONTRIBUTING.md
├── README.md
├── config.json
├── LICENSE
└── SS.py
/readme.md:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/wesbite/public/CLEAN:
--------------------------------------------------------------------------------
1 | A
2 |
--------------------------------------------------------------------------------
/wesbite/public/Setup Shift.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elfalehed/setup-shift/HEAD/wesbite/public/Setup Shift.png
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing to Setup Shift
2 |
3 | Thanks for your interest in SS! You are very welcome to contirbute. If you are proposing a new feature, make sure to open a new issue to make sure it is inline with the project goals.
4 |
5 | ## Submitting a PR
6 | Be sure to run python3 SS.py before you make your PR to amek sure you haven't broken anything.
7 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 
2 |
3 | When you change your setup, buy a new one or whatever it is hard to re:install all of the previous packages and programs you used to have. Now, you have Setup Shift for that
4 |
5 | ## Features
6 | * Autodownload your current setup on a new machine
7 | * Add a configlist of the current packages to have it on you at ALL time (in case of emergency and you had to format everything)
8 |
9 | ## Quick start
10 | 1. git clone https://github.com/elfalehed/setup-shift.git
11 | 2. python3 SS.py
12 |
--------------------------------------------------------------------------------
/config.json:
--------------------------------------------------------------------------------
1 | {"Linux": [["npm", "sudo apt install npm"], ["VScode", "google-chrome https://code.visualstudio.com/docs/setup/linux"], ["sublime", "sudo apt-get install sublime-text"], ["tailwindcss", "npm install -D tailwindcss@latest postcss@latest autoprefixer@latest"]], "macOS": [["npm", "brew install npm"], ["VScode", "open https://code.visualstudio.com/docs/setup/mac"], ["sublime", "brew install --cask sublime-text"], ["tailwindcss", "npm install -D tailwindcss@latest postcss@latest autoprefixer@latest"]], "Windows": [["npm", "npm install -g npm"], ["VScode", "start https://code.visualstudio.com/docs/setup/windows"], ["sublime", "choco install sublime-text"], ["tailwindcss", "npm install -D tailwindcss@latest postcss@latest autoprefixer@latest"]]}
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Mohamed Elfaleh
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/SS.py:
--------------------------------------------------------------------------------
1 | #! /usr/bin/python3
2 | import os
3 | # import yaml
4 | import json
5 | from colorama import Fore
6 | import platform
7 |
8 | art = """
9 | ___ ____ ____ __ __ ____ ___ _ _ ____ ____ ____
10 | / __)( ___)(_ _)( )( )( _ \ / __)( )_( )(_ _)( ___)(_ _)
11 | \__ \ )__) )( )(__)( )___/ \__ \ ) _ ( _)(_ )__) )(
12 | (___/(____) (__) (______)(__) (___/(_) (_)(____)(__) (__)
13 | """
14 |
15 | def detectOs():
16 | system_name = platform.system()
17 | if system_name == "Linux":
18 | return "Linux"
19 | elif system_name == "Darwin":
20 | return "macOS"
21 | elif system_name == "Windows":
22 | return "Windows"
23 | else:
24 | return None
25 |
26 |
27 | def valid_input():
28 | while True:
29 | try:
30 | option = int(input(":$ "))
31 | break
32 | except ValueError:
33 | print('Please type a valid option.')
34 | return option
35 |
36 |
37 | def installer(config,OS):
38 | packages = config[OS]
39 | i = 1
40 | for p in packages:
41 | print('[', i, ']', p[0], '\n')
42 | i = i+1
43 | option = valid_input()
44 | if (option in range(1, len(packages)+1)):
45 | os.system(packages[option-1][1])
46 | else:
47 | print(Fore.YELLOW + "Pick a valid option\n")
48 | return None
49 |
50 |
51 | def add(config,OS):
52 | print(Fore.YELLOW + "What's the name of the automated command: ")
53 | pack_name = str(input(':$ '))
54 | print(Fore.YELLOW + "What's the command to run the command: ")
55 | pack_com = str(input(':$ '))
56 | pack = [pack_name, pack_com]
57 | config[OS].append(pack)
58 | return config
59 |
60 |
61 | def remove(config,OS):
62 | packages = config[OS]
63 | i = 1
64 | for p in packages:
65 | print('[', i, ']', p[0], '\n')
66 | i = i+1
67 |
68 | print(Fore.YELLOW + "What's the number of the command you want to delete: \n")
69 | option = valid_input()
70 |
71 | print(Fore.YELLOW + "Are you sure? y/n")
72 | confirm = str(input(':$ ')).upper().replace(" ", "")
73 |
74 | if confirm == "YES" or confirm == "Y" and option in range(1, len(packages)+1):
75 | config[OS].pop(option-1)
76 | elif (confirm == "NO" or confirm == "N"):
77 | print(Fore.YELLOW + "\nBack to the main menu\n")
78 | else:
79 | print(Fore.YELLOW + "\nPick a valid option\n")
80 | return config
81 |
82 |
83 | def main():
84 | with open('config.json', 'r') as file:
85 | config = json.load(file)
86 | with open('config.json', 'w') as file:
87 | json.dump(config, file)
88 | OS=detectOs()
89 | if not OS:
90 | print(Fore.BLACK+"[!!] Unknown or Unsupported operating system !")
91 | exit()
92 | while True:
93 | print(art)
94 | print(
95 | Fore.CYAN + "[!] Don't forget to give us a star on GitHub.\n")
96 | print(
97 | Fore.RED + "[1] Install packages \n[2] Add a package to the config\n[3] Remove a package from the config\n[4] Exit")
98 | option = valid_input()
99 | if (option == 1):
100 | installer(config,OS)
101 | elif (option == 2):
102 | config = add(config,OS)
103 | elif (option == 3):
104 | config = remove(config,OS)
105 | elif (option == 4):
106 | exit()
107 | else:
108 | print('Please choose an appropriate option.\n')
109 |
110 |
111 | if __name__ == '__main__':
112 | main()
113 |
--------------------------------------------------------------------------------