-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to specify other shell(Arg) #3299
Changes from 5 commits
248c204
a143d9d
fd22a00
dadfcbd
682ea3b
a88442a
7d030e8
7a7f38c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure, but perhaps an integration test is not the right thing for this feature? Maybe this should just be a unit test in |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package custom_commands | ||
|
||
import ( | ||
"github.com/jesseduffield/lazygit/pkg/config" | ||
. "github.com/jesseduffield/lazygit/pkg/integration/components" | ||
) | ||
|
||
var CustomShell = NewIntegrationTest(NewIntegrationTestArgs{ | ||
Description: "Confirms a popup appears on first opening Lazygit", | ||
ExtraCmdArgs: []string{}, | ||
Skip: false, | ||
SetupConfig: func(config *config.AppConfig) { | ||
config.UserConfig.OS.Shell = "sh" | ||
config.UserConfig.OS.ShellArg = "-c" | ||
}, | ||
SetupRepo: func(shell *Shell) {}, | ||
Run: func(t *TestDriver, keys config.KeybindingConfig) { | ||
t.Views().Files(). | ||
IsEmpty(). | ||
IsFocused(). | ||
Press(keys.Universal.ExecuteCustomCommand) | ||
|
||
t.ExpectPopup().Prompt(). | ||
Title(Equals("Custom command:")). | ||
Type("echo hello world"). | ||
Confirm() | ||
}, | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1292,6 +1292,13 @@ | |
"copyToClipboardCmd": { | ||
"type": "string", | ||
"description": "CopyToClipboardCmd is the command for copying to clipboard.\nSee https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#custom-command-for-copying-to-clipboard" | ||
}, | ||
"shell": { | ||
"type": "string", | ||
"description": "Shell and ShellArg are the shell and corresponding argument to be used for executing custom commands.\nSee https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#custom-command-for-copying-to-clipboard" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The URL here needs to point to the "Custom Shell for executing arbitrary commands" section of the |
||
}, | ||
"shellArg": { | ||
"type": "string" | ||
} | ||
}, | ||
"additionalProperties": false, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be better to move this logic into
NewOsCommand
? We want all os commands to inherit that setting, right? Or do we only want the command runner for custom commands to use theshell
andshellArgs
from the userconfig?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. I don't know how to access config.OS from there, though 😕
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On second thought, I think it would make more sense to pass the
OSConfig
struct intooscommands.GetPlatform
and get that function to extract theshell
andshellArg
values from there and use them there directly.You would be able to access the config through the
Common
struct that's passed intoNewOsCommand
function.