diff options
| author | Yavor Konstantinov <7553015+sehnsucht13@users.noreply.github.com> | 2025-10-24 19:02:44 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-24 19:02:44 -0700 |
| commit | 922bb171944190dc8a7c9a563cd95da39d9c2ebb (patch) | |
| tree | 096ba95d7c33666471bb2c5faf8491ecbe0decca /weed/shell/shell_liner.go | |
| parent | fa35efc07671b26bb2fdf21f9f55e378ce92ffd1 (diff) | |
| download | seaweedfs-922bb171944190dc8a7c9a563cd95da39d9c2ebb.tar.xz seaweedfs-922bb171944190dc8a7c9a563cd95da39d9c2ebb.zip | |
Store full shell command in shell history (#7378)
Store shell command in history before parsing
Store the shell command in history before parsing it. This will allow users to press the 'Up' arrow and see the entire command.
Diffstat (limited to 'weed/shell/shell_liner.go')
| -rw-r--r-- | weed/shell/shell_liner.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/weed/shell/shell_liner.go b/weed/shell/shell_liner.go index 0eb2ad4a3..220b04343 100644 --- a/weed/shell/shell_liner.go +++ b/weed/shell/shell_liner.go @@ -84,6 +84,10 @@ func RunShell(options ShellOptions) { return } + if strings.TrimSpace(cmd) != "" { + line.AppendHistory(cmd) + } + for _, c := range util.StringSplit(cmd, ";") { if processEachCmd(reg, c, commandEnv) { return @@ -95,8 +99,6 @@ func RunShell(options ShellOptions) { func processEachCmd(reg *regexp.Regexp, cmd string, commandEnv *CommandEnv) bool { cmds := reg.FindAllString(cmd, -1) - line.AppendHistory(cmd) - if len(cmds) == 0 { return false } else { |
