summaryrefslogtreecommitdiffstats
path: root/pkg/commands/custom.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/commands/custom.go')
-rw-r--r--pkg/commands/custom.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/pkg/commands/custom.go b/pkg/commands/custom.go
new file mode 100644
index 000000000..a9bf64bf4
--- /dev/null
+++ b/pkg/commands/custom.go
@@ -0,0 +1,29 @@
+package commands
+
+import (
+ "github.com/jesseduffield/lazygit/pkg/commands/oscommands"
+ "github.com/jesseduffield/lazygit/pkg/common"
+)
+
+type CustomCommands struct {
+ *common.Common
+
+ cmd oscommands.ICmdObjBuilder
+}
+
+func NewCustomCommands(
+ common *common.Common,
+ cmd oscommands.ICmdObjBuilder,
+) *CustomCommands {
+ return &CustomCommands{
+ Common: common,
+ cmd: cmd,
+ }
+}
+
+// Only to be used for the sake of running custom commands specified by the user.
+// If you want to run a new command, try finding a place for it in one of the neighbouring
+// files, or creating a new BlahCommands struct to hold it.
+func (self *CustomCommands) RunWithOutput(cmdStr string) (string, error) {
+ return self.cmd.New(cmdStr).RunWithOutput()
+}