Use RESH instead of Resh

pull/195/head v3.0.0-rc1
Simon Let 3 years ago
parent ebfc4565d6
commit 30b254cf30
  1. 2
      cmd/cli/main.go
  2. 4
      cmd/collect/main.go
  3. 4
      cmd/postcollect/main.go
  4. 2
      cmd/session-init/main.go
  5. 8
      internal/histfile/histfile.go
  6. 2
      scripts/rawinstall.sh

@ -59,7 +59,7 @@ func runReshCli(out *output.Output, config cfg.Config) (string, int) {
const missing = "<missing cdxgtcpboqwrdom>" const missing = "<missing cdxgtcpboqwrdom>"
flags := pflag.NewFlagSet("", pflag.ExitOnError) flags := pflag.NewFlagSet("", pflag.ExitOnError)
sessionID := flags.String("session-id", missing, "Resh generated session ID") sessionID := flags.String("session-id", missing, "RESH generated session ID")
pwd := flags.String("pwd", missing, "$PWD - present working directory") pwd := flags.String("pwd", missing, "$PWD - present working directory")
gitOriginRemote := flags.String("git-remote", missing, "> git remote get-url origin") gitOriginRemote := flags.String("git-remote", missing, "> git remote get-url origin")
query := flags.String("query", "", "Search query") query := flags.String("query", "", "Search query")

@ -42,8 +42,8 @@ func main() {
gitRemote := flags.String("git-remote", "", "> git remote get-url origin") gitRemote := flags.String("git-remote", "", "> git remote get-url origin")
home := flags.String("home", "", "$HOME") home := flags.String("home", "", "$HOME")
pwd := flags.String("pwd", "", "$PWD - present working directory") pwd := flags.String("pwd", "", "$PWD - present working directory")
recordID := flags.String("record-id", "", "Resh generated record ID") recordID := flags.String("record-id", "", "RESH generated record ID")
sessionID := flags.String("session-id", "", "Resh generated session ID") sessionID := flags.String("session-id", "", "RESH generated session ID")
sessionPID := flags.Int("session-pid", -1, "$$ - Shell session PID") sessionPID := flags.Int("session-pid", -1, "$$ - Shell session PID")
shell := flags.String("shell", "", "Current shell") shell := flags.String("shell", "", "Current shell")
shlvl := flags.Int("shlvl", -1, "$SHLVL") shlvl := flags.Int("shlvl", -1, "$SHLVL")

@ -38,8 +38,8 @@ func main() {
flags := pflag.NewFlagSet("", pflag.ExitOnError) flags := pflag.NewFlagSet("", pflag.ExitOnError)
exitCode := flags.Int("exit-code", -1, "Exit code") exitCode := flags.Int("exit-code", -1, "Exit code")
sessionID := flags.String("session-id", "", "Resh generated session ID") sessionID := flags.String("session-id", "", "RESH generated session ID")
recordID := flags.String("record-id", "", "Resh generated record ID") recordID := flags.String("record-id", "", "RESH generated record ID")
shlvl := flags.Int("shlvl", -1, "$SHLVL") shlvl := flags.Int("shlvl", -1, "$SHLVL")
rtb := flags.String("time-before", "-1", "Before $EPOCHREALTIME") rtb := flags.String("time-before", "-1", "Before $EPOCHREALTIME")
rta := flags.String("time-after", "-1", "After $EPOCHREALTIME") rta := flags.String("time-after", "-1", "After $EPOCHREALTIME")

@ -36,7 +36,7 @@ func main() {
args := opt.HandleVersionOpts(out, os.Args, version, commit) args := opt.HandleVersionOpts(out, os.Args, version, commit)
flags := pflag.NewFlagSet("", pflag.ExitOnError) flags := pflag.NewFlagSet("", pflag.ExitOnError)
sessionID := flags.String("session-id", "", "Resh generated session ID") sessionID := flags.String("session-id", "", "RESH generated session ID")
sessionPID := flags.Int("session-pid", -1, "$$ - Shell session PID") sessionPID := flags.Int("session-pid", -1, "$$ - Shell session PID")
flags.Parse(args) flags.Parse(args)

@ -69,7 +69,7 @@ func (h *Histfile) loadCliRecords(recs []record.V1) {
rec := recs[i] rec := recs[i]
h.cliRecords.AddRecord(&rec) h.cliRecords.AddRecord(&rec)
} }
h.sugar.Infow("Resh history loaded", h.sugar.Infow("RESH history loaded",
"historyRecordsCount", len(h.cliRecords.List), "historyRecordsCount", len(h.cliRecords.List),
) )
} }
@ -87,7 +87,7 @@ func (h *Histfile) loadHistory(bashHistoryPath, zshHistoryPath string, maxInitHi
useNativeHistories := false useNativeHistories := false
if size/1024 < minInitHistSizeKB { if size/1024 < minInitHistSizeKB {
useNativeHistories = true useNativeHistories = true
h.sugar.Warnw("Resh_history is too small - loading native bash and zsh history ...") h.sugar.Warnw("RESH history is too small - loading native bash and zsh history ...")
h.bashCmdLines = records.LoadCmdLinesFromBashFile(h.sugar, bashHistoryPath) h.bashCmdLines = records.LoadCmdLinesFromBashFile(h.sugar, bashHistoryPath)
h.sugar.Infow("Bash history loaded", "cmdLineCount", len(h.bashCmdLines.List)) h.sugar.Infow("Bash history loaded", "cmdLineCount", len(h.bashCmdLines.List))
h.zshCmdLines = records.LoadCmdLinesFromZshFile(h.sugar, zshHistoryPath) h.zshCmdLines = records.LoadCmdLinesFromZshFile(h.sugar, zshHistoryPath)
@ -102,7 +102,7 @@ func (h *Histfile) loadHistory(bashHistoryPath, zshHistoryPath string, maxInitHi
if err != nil { if err != nil {
h.sugar.Fatalf("Failed to read history file: %v", err) h.sugar.Fatalf("Failed to read history file: %v", err)
} }
h.sugar.Infow("Resh history loaded from file", h.sugar.Infow("RESH history loaded from file",
"historyFile", h.historyPath, "historyFile", h.historyPath,
"recordCount", len(history), "recordCount", len(history),
) )
@ -110,7 +110,7 @@ func (h *Histfile) loadHistory(bashHistoryPath, zshHistoryPath string, maxInitHi
// NOTE: keeping this weird interface for now because we might use it in the future // NOTE: keeping this weird interface for now because we might use it in the future
// when we only load bash or zsh history // when we only load bash or zsh history
reshCmdLines := loadCmdLines(h.sugar, history) reshCmdLines := loadCmdLines(h.sugar, history)
h.sugar.Infow("Resh history loaded and processed", h.sugar.Infow("RESH history loaded and processed",
"recordCount", len(reshCmdLines.List), "recordCount", len(reshCmdLines.List),
) )
if !useNativeHistories { if !useNativeHistories {

@ -35,7 +35,7 @@ echo " * Latest version: $version (git tag: $tag)"
# TODO: compare semanitcally instead of just using equality # TODO: compare semanitcally instead of just using equality
if [ "${__RESH_VERSION:-}" == "$version" ]; then if [ "${__RESH_VERSION:-}" == "$version" ]; then
echo " * Resh is up to date - nothing to do - exiting." echo " * RESH is up to date - nothing to do - exiting."
exit 0 exit 0
fi fi

Loading…
Cancel
Save