summaryrefslogtreecommitdiffstats
path: root/pkg/commands/git_commands/diff.go
diff options
context:
space:
mode:
authorAzraelSec <me@azraelsec.sh>2023-11-02 23:31:38 +0100
committerStefan Haller <stefan@haller-berlin.de>2023-12-07 08:30:03 +0100
commitc7012528fce35802440342e0f9e69d5c84acbabb (patch)
tree41039fe4d290485fffbafbda9a593b06e77f04a3 /pkg/commands/git_commands/diff.go
parent2162e5ff64607856fe76b5f9e37612e415852a25 (diff)
feat: introduce a copy menu into the file view
Diffstat (limited to 'pkg/commands/git_commands/diff.go')
-rw-r--r--pkg/commands/git_commands/diff.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/pkg/commands/git_commands/diff.go b/pkg/commands/git_commands/diff.go
index 2f0e1b547..1e5f98244 100644
--- a/pkg/commands/git_commands/diff.go
+++ b/pkg/commands/git_commands/diff.go
@@ -17,3 +17,26 @@ func (self *DiffCommands) DiffCmdObj(diffArgs []string) oscommands.ICmdObj {
NewGitCmd("diff").Arg("--submodule", "--no-ext-diff", "--color").Arg(diffArgs...).ToArgv(),
)
}
+
+func (self *DiffCommands) internalDiffCmdObj(diffArgs ...string) *GitCommandBuilder {
+ return NewGitCmd("diff").
+ Arg("--no-ext-diff", "--no-color").
+ Arg(diffArgs...)
+}
+
+func (self *DiffCommands) GetPathDiff(path string, staged bool) (string, error) {
+ return self.cmd.New(
+ self.internalDiffCmdObj().
+ ArgIf(staged, "--staged").
+ Arg(path).
+ ToArgv(),
+ ).RunWithOutput()
+}
+
+func (self *DiffCommands) GetAllDiff(staged bool) (string, error) {
+ return self.cmd.New(
+ self.internalDiffCmdObj().
+ ArgIf(staged, "--staged").
+ ToArgv(),
+ ).RunWithOutput()
+}