diff options
Diffstat (limited to 'pkg/commands/git_commands/git_command_builder.go')
-rw-r--r-- | pkg/commands/git_commands/git_command_builder.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/pkg/commands/git_commands/git_command_builder.go b/pkg/commands/git_commands/git_command_builder.go index 4aa35be5f..b6fe57364 100644 --- a/pkg/commands/git_commands/git_command_builder.go +++ b/pkg/commands/git_commands/git_command_builder.go @@ -60,6 +60,14 @@ func (self *GitCommandBuilder) Dir(path string) *GitCommandBuilder { return self } +func (self *GitCommandBuilder) DirIf(condition bool, path string) *GitCommandBuilder { + if condition { + return self.Dir(path) + } + + return self +} + // Note, you may prefer to use the Dir method instead of this one func (self *GitCommandBuilder) Worktree(path string) *GitCommandBuilder { // worktree arg comes before the command |