Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/rshell/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func run(args []string, stdin io.Reader, stdout, stderr io.Writer) int {

cmd.Flags().StringVarP(&command, "command", "c", "", "shell command string to execute")
cmd.Flags().MarkHidden("command") //nolint:errcheck // flag is guaranteed to exist
cmd.Flags().StringVarP(&allowedPaths, "allowed-path", "p", "", "comma-separated list of directories the shell is allowed to access")
cmd.Flags().StringVarP(&allowedPaths, "allowed-paths", "p", "", "comma-separated list of directories the shell is allowed to access")
cmd.Flags().StringVar(&allowedCommands, "allowed-commands", "", "comma-separated list of namespaced commands (e.g. rshell:cat,rshell:find)")
cmd.Flags().BoolVar(&allowAllCmds, "allow-all-commands", false, "allow execution of all commands (builtins and external)")

Expand Down
4 changes: 2 additions & 2 deletions cmd/rshell/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func TestAllowedPathCommaSeparated(t *testing.T) {
if runtime.GOOS == "windows" {
extraDir = filepath.ToSlash(extraDir)
}
code, stdout, _ := runCLI(t, "--allow-all-commands", "-c", `cat `+filePath, "--allowed-path", dir+","+extraDir)
code, stdout, _ := runCLI(t, "--allow-all-commands", "-c", `cat `+filePath, "--allowed-paths", dir+","+extraDir)
assert.Equal(t, 0, code)
assert.Contains(t, stdout, "hello from testfile")
}
Expand All @@ -138,7 +138,7 @@ func TestVariableExpansion(t *testing.T) {
func TestHelp(t *testing.T) {
code, stdout, _ := runCLI(t, "--help")
assert.Equal(t, 0, code)
assert.Contains(t, stdout, "--allowed-path")
assert.Contains(t, stdout, "--allowed-paths")
assert.Contains(t, stdout, "--allowed-commands")
assert.Contains(t, stdout, "--allow-all-commands")
assert.NotContains(t, stdout, "--command", "-c/--command should be hidden from help")
Expand Down
Loading