get realpath in collect

pull/3/head
Simon Let 7 years ago
parent bf9167e96a
commit 833acae4da
  1. 1
      bashrc.sh
  2. 9
      collect/resh-collect.go
  3. 2
      common/resh-common.go

@ -59,7 +59,6 @@ precmd() {
-login "$__RESH_LOGIN" \ -login "$__RESH_LOGIN" \
-path "$__RESH_PATH" \ -path "$__RESH_PATH" \
-pwd "$__RESH_PWD" \ -pwd "$__RESH_PWD" \
-realPwd "$(realpath $__RESH_PWD)" \
-shell "$__RESH_SHELL" \ -shell "$__RESH_SHELL" \
-term "$__RESH_TERM" \ -term "$__RESH_TERM" \
-pid "$__RESH_PID" -shellPid "$__RESH_SHELL_PID" \ -pid "$__RESH_PID" -shellPid "$__RESH_SHELL_PID" \

@ -53,7 +53,6 @@ func main() {
windowId := flag.Int("windowId", -1, "$WINDOWID - session id") windowId := flag.Int("windowId", -1, "$WINDOWID - session id")
shlvl := flag.Int("shlvl", -1, "$SHLVL") shlvl := flag.Int("shlvl", -1, "$SHLVL")
realPwd := flag.String("realPwd", "", "realpath $PWD")
host := flag.String("host", "", "$HOSTNAME") host := flag.String("host", "", "$HOSTNAME")
hosttype := flag.String("hosttype", "", "$HOSTTYPE") hosttype := flag.String("hosttype", "", "$HOSTTYPE")
ostype := flag.String("ostype", "", "$OSTYPE") ostype := flag.String("ostype", "", "$OSTYPE")
@ -95,6 +94,12 @@ func main() {
realtimeBeforeLocal := realtimeBefore + timezoneBeforeOffset realtimeBeforeLocal := realtimeBefore + timezoneBeforeOffset
realtimeAfterLocal := realtimeAfter + timezoneAfterOffset realtimeAfterLocal := realtimeAfter + timezoneAfterOffset
realPwd, err := filepath.EvalSymlinks(*pwd)
if err != nil {
log.Println("err while handling realpath:", err)
realPwd = ""
}
gitDir, gitRealDir := getGitDirs(*gitCdup, *gitCdupExitCode, *pwd) gitDir, gitRealDir := getGitDirs(*gitCdup, *gitCdupExitCode, *pwd)
if *gitRemoteExitCode != 0 { if *gitRemoteExitCode != 0 {
*gitRemote = "" *gitRemote = ""
@ -119,7 +124,7 @@ func main() {
Term: *term, Term: *term,
// non-posix // non-posix
RealpathPwd: *realPwd, RealPwd: realPwd,
Pid: *pid, Pid: *pid,
ShellPid: *shellPid, ShellPid: *shellPid,
WindowId: *windowId, WindowId: *windowId,

@ -18,7 +18,7 @@ type Record struct {
Term string `json:"term"` Term string `json:"term"`
// non-posix"` // non-posix"`
RealpathPwd string `json:"realpathPwd"` RealPwd string `json:"realPwd"`
Pid int `json:"pid"` Pid int `json:"pid"`
ShellPid int `json:"shellPid"` ShellPid int `json:"shellPid"`
WindowId int `json:"windowId"` WindowId int `json:"windowId"`

Loading…
Cancel
Save