-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathutils.py
41 lines (34 loc) · 1.15 KB
/
utils.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
from os.path import exists
from os import system
import platform
import subprocess
class CommitUtils:
def __init__(self):
pass
@classmethod
def add_files(cls, args_after_add):
"""Takes in the arguements after an
add command and git adds the files"""
# supports -add and --add-push
recognised_options = ["-m", "--push", "-e", "--extra", "-sh", "-s", "--strict"]
for arg in args_after_add:
if arg in recognised_options:
break
file_exists = exists(arg)
if file_exists:
system(f"git add {arg}")
else:
usr_opt = input(f"Error, '{arg}' file not found. Continue? [y/n] ")
if (usr_opt.lower() in ( "y", "yes", "")):
pass
else:
print("Exiting, have a nice day...")
print("")
exit()
class Clipboard:
def __init__(self):
os = platform.system()
self.os = os
def copy(self, payload):
if self.os == "Darwin":
subprocess.run("pbcopy", universal_newlines=True, input=payload)