-
Notifications
You must be signed in to change notification settings - Fork 0
/
Cmd.py
49 lines (29 loc) · 944 Bytes
/
Cmd.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from cmd import Cmd
import os
import subprocess
# os.environ["GIT_PYTHON_REFRESH"] = "quiet"
import git
class MyPrompt(Cmd):
prompt = '>>>'
def do_add(self, inputpath):
path = 'E:/save/Desktop/Visual Studio Code Projekts/' + inputpath
try:
os.mkdir(path)
git.Repo.init(path)
with open(os.path.join(path, 'README.md'), 'w'):
pass
subprocess.run("git add README.md")
except:
print("Failed to create folder at: " + path)
def do_cd(self, inp):
path = 'E:/save/Desktop/Visual Studio Code Projekts/'
global inppath
try:
inppath = path + inp
except:
print("Cant find directroy")
def do_add_file(self, inp):
path = 'E:/save/Desktop/Visual Studio Code Projekts/'
with open(os.path.join(inppath, inp), "w"):
pass
MyPrompt().cmdloop()