-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Arnaudov, Stanislav Tomov
committed
Jun 16, 2020
1 parent
1eb8f7c
commit 30720fd
Showing
7 changed files
with
53 additions
and
23 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,20 @@ | ||
import subprocess | ||
import sys | ||
|
||
import code_manager.utils.logger | ||
|
||
class CommitCommand: | ||
|
||
name = 'commit' | ||
|
||
def __init__(self): | ||
pass | ||
|
||
def execute(self, arguments, root): | ||
pass | ||
def execute(self, args, path): | ||
if not os.path.exists(os.path.join(path, '.git')): | ||
return 0 | ||
ret = subprocess.run(['git', 'commit', *args], stdout=subprocess.STDOUT, cwd=path) | ||
return 0 | ||
|
||
|
||
ExportedClass = CommitCommand |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,21 @@ | ||
import subprocess | ||
import sys | ||
|
||
import code_manager.utils.logger | ||
|
||
class GrepCommand: | ||
|
||
name = 'grep' | ||
|
||
def __init__(self): | ||
pass | ||
|
||
def execute(self, args, path): | ||
|
||
ret = subprocess.run(['git', '-C', path, 'grep', *args], stdout=subprocess.PIPE) | ||
return path, ret.returncode, ret.stdout | ||
ret = subprocess.run(['grep', '-r', *args], stdout=subprocess.PIPE, cwd=path) | ||
|
||
for line in ret.stdout.splitlines(): | ||
sys.stdout.buffer.write(bytes(self.pack + ':', 'utf-8') + line + b'\n') | ||
sys.stdout.buffer.flush() | ||
|
||
return 0 | ||
|
||
|
||
ExportedClass = GrepCommand |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,20 @@ | ||
import subprocess | ||
import sys | ||
|
||
import code_manager.utils.logger | ||
|
||
class PullCommand: | ||
|
||
name = 'pull' | ||
|
||
def __init__(self): | ||
pass | ||
|
||
def execute(self, arguments, root): | ||
pass | ||
def execute(self, args, path): | ||
if not os.path.exists(os.path.join(path, '.git')): | ||
return 0 | ||
ret = subprocess.run(['git', 'pull', *args], stdout=subprocess.STDOUT, cwd=path) | ||
return 0 | ||
|
||
|
||
ExportedClass = PullCommand |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,18 @@ | ||
class PushCommand: | ||
import subprocess | ||
import os | ||
import sys | ||
|
||
name = 'push' | ||
import code_manager.utils.logger | ||
|
||
def __init__(self): | ||
pass | ||
class PushCommand: | ||
|
||
def execute(self, arguments, root): | ||
pass | ||
name = 'push' | ||
|
||
def execute(self, args, path): | ||
if not os.path.exists(os.path.join(path, '.git')): | ||
return 0 | ||
ret = subprocess.run(['git', 'push', *args], stdout=subprocess.STDOUT, cwd=path) | ||
return 0 | ||
|
||
|
||
ExportedClass = PushCommand |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
import subprocess | ||
import sys | ||
|
||
import code_manager.utils.logger | ||
|
||
class SedCommand: | ||
|
||
name = 'sed' | ||
|
||
def __init__(self): | ||
pass | ||
|
||
def execute(self, arguments, root): | ||
pass | ||
def execute(self, args, path): | ||
ret = subprocess.run(['sed', *args], stdout=subprocess.PIPE, cwd=path) | ||
return 0 | ||
|
||
|
||
ExportedClass = SedCommand |
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
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