🔖 Update config

This commit is contained in:
Smirnov Olexandr 2020-10-31 22:52:51 +02:00
parent 99cc99c7d4
commit 394d56fa69
27 changed files with 478 additions and 398 deletions

View file

@ -96,5 +96,3 @@ class extract_to_dirs(Command):
obj = CommandLoader(args=['aunpack'] + make_flags(f.path) + [f.path], descr=descr, read=True)
obj.signal_bind('after', refresh)
self.fm.loader.add(obj)

View file

@ -3,25 +3,19 @@ from ranger.api.commands import Command
class git(Command):
commands = 'init status clone add rm restore commit remote push'.split()
def execute(self):
# empty
if not self.arg(1):
return self.fm.notify("For commands check \"git help\"")
# help
if self.arg(1) == "help":
return self.fm.notify("Not done yet!", bad=True)
# init
if self.arg(1) == self.commands[0]:
subprocess.run(["git", "init", "--quiet"])
return self.fm.notify("Repository initialized successefully")
# status
if self.arg(1) == self.commands[1]:
output = subprocess.check_output(["git", "status"]).decode()
@ -30,7 +24,6 @@ class git(Command):
return self.fm.edit_file('/tmp/gitplug-status')
# clone
if self.arg(1) == self.commands[2]:
if not self.arg(2):
return self.fm.notify("Missing url!", bad=True)
@ -39,7 +32,6 @@ class git(Command):
subprocess.run(["git", "clone", self.arg(2), "--quiet"])
return self.fm.notify("Repository successfully cloned!")
# add
if self.arg(1) == self.commands[3]:
if not self.arg(2):
return self.fm.notify("Missing arguments! Usage :git add <file>", bad=True)
@ -48,7 +40,6 @@ class git(Command):
subprocess.run(["git", "add", self.arg(2)])
return self.fm.notify("Successfully added files to branch!")
#rm
if self.arg(1) == self.commands[4]:
if not self.arg(2):
return self.fm.notify("Missing arguments! Usage :git rm <file>", bad=True)
@ -57,7 +48,6 @@ class git(Command):
subprocess.run(["git", "rm", self.arg(2)])
return self.fm.notify("Successfully removed files from branch!")
# restore
if self.arg(1) == self.commands[5]:
if not self.arg(2):
return self.fm.notify("Missing arguments! Usage :git restore <file>", bad=True)
@ -66,7 +56,6 @@ class git(Command):
subprocess.run(["git", "restore", "--staged", self.arg(2), "--quiet"])
return self.fm.notify("Successfully restored files!")
# commit
if self.arg(1) == self.commands[6]:
if not self.rest(2):
return self.fm.notify("Missing commit text", bad=True)
@ -75,7 +64,6 @@ class git(Command):
subprocess.run(["git", "commit", "-m", self.rest(2), "--quiet"])
return self.fm.notify("Successfully commited!")
# remote
if self.arg(1) == self.commands[7]:
if not self.arg(2):
return self.fm.notify("Missing arguments! Use: git remote add/rm <name> <url>", bad=True)
@ -100,7 +88,6 @@ class git(Command):
subprocess.run(["git", "remote", "rm", self.arg(3)])
return self.fm.notify("Remote successfully removed")
# push
if self.arg(1) == self.commands[8]:
if self.arg(2) == "-u" and self.arg(3) and self.arg(4):
subprocess.run(["git", "push", "--quiet", "-u", self.arg(3), self.arg(4)])