diff --git a/Makefile b/Makefile index 3bbc6db..d34ebd0 100644 --- a/Makefile +++ b/Makefile @@ -5,10 +5,10 @@ build: submodules resh-collect resh-daemon install: build | $(HOME)/.resh $(HOME)/.resh/bin $(HOME)/.config $(HOME)/.resh/resh-uuid - cp submodules/bash-preexec/bash-preexec.sh ~/.bash-preexec.sh -f - cp config.toml ~/.config/resh.toml -f - cp shellrc.sh ~/.resh/shellrc -f - cp resh-* ~/.resh/bin/ -f + cp -f submodules/bash-preexec/bash-preexec.sh ~/.bash-preexec.sh + cp -f config.toml ~/.config/resh.toml + cp -f shellrc.sh ~/.resh/shellrc + cp -f resh-* ~/.resh/bin/ [ ! -f ~/resh-history.json ] || mv ~/resh-history.json ~/.resh/history.json grep '[[ -f ~/.resh/shellrc ]] && source ~/.resh/shellrc' ~/.bashrc ||\ echo '[[ -f ~/.resh/shellrc ]] && source ~/.resh/shellrc' >> ~/.bashrc @@ -34,7 +34,7 @@ $(HOME)/.resh $(HOME)/.resh/bin $(HOME)/.config: mkdir -p $@ $(HOME)/.resh/resh-uuid: - cat /proc/sys/kernel/random/uuid > $@ + -cat /proc/sys/kernel/random/uuid > $@ .PHONY: submodules build install diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..cb0f920 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module github.com/curusarn/resh + +require github.com/BurntSushi/toml v0.3.1 // indirect diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..9cb2df8 --- /dev/null +++ b/go.sum @@ -0,0 +1,2 @@ +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= diff --git a/shellrc.sh b/shellrc.sh index eca16ab..d598526 100644 --- a/shellrc.sh +++ b/shellrc.sh @@ -5,15 +5,17 @@ PATH=$PATH:~/.resh/bin # fi # export __RESH_RT_SESSION=$EPOCHREALTIME -export __RESH_RT_SESSION=$(date +%s.%N) -export __RESH_RT_SESS_SINCE_BOOT=$(cat /proc/uptime | cut -d' ' -f1) +export __RESH_RT_SESSION=$(date +%s) +#export __RESH_RT_SESS_SINCE_BOOT=$(cat /proc/uptime | cut -d' ' -f1) +export __RESH_RT_SESS_SINCE_BOOT=1 export __RESH_SESSION_ID=$(cat /proc/sys/kernel/random/uuid) -if [ $(uname) == "Darvin" ]; then +if [ $(uname) = "Darwin" ]; then export __RESH_OS_RELEASE_ID="macos" export __RESH_OS_RELEASE_VERSION_ID=$(sw_vers -productVersion 2>/dev/null) export __RESH_OS_RELEASE_NAME="macOS" export __RESH_OS_RELEASE_PRETTY_NAME="Mac OS X" + export __RESH_WINDOWID="1" # session else export __RESH_OS_RELEASE_ID=$(source /etc/os-release; echo $ID) export __RESH_OS_RELEASE_VERSION_ID=$(source /etc/os-release; echo $VERSION_ID) @@ -44,7 +46,7 @@ __resh_preexec() { # non-posix __RESH_SHELL_PID="$$" # pid (subshells don't affect it) - __RESH_WINDOWID="$WINDOWID" # session +# __RESH_WINDOWID="$WINDOWID" # session __RESH_OSTYPE="$OSTYPE" __RESH_MACHTYPE="$MACHTYPE" __RESH_SHLVL="$SHLVL" @@ -72,9 +74,10 @@ __resh_preexec() { echo "resh PANIC unrecognized shell" fi # time - __RESH_TZ_BEFORE=$(date +%:z) + #__RESH_TZ_BEFORE=$(date +%:z) + __RESH_TZ_BEFORE=2:00 # __RESH_RT_BEFORE="$EPOCHREALTIME" - __RESH_RT_BEFORE="$(date +%s.%N)" + __RESH_RT_BEFORE="$(date +%s)" # TODO: we should evaluate symlinks in preexec # -> maybe create resh-precollect that could handle most of preexec @@ -89,8 +92,9 @@ __resh_preexec() { __resh_precmd() { __RESH_EXIT_CODE=$? # __RESH_RT_AFTER=$EPOCHREALTIME - __RESH_RT_AFTER="$(date +%s.%N)" - __RESH_TZ_AFTER=$(date +%:z) + __RESH_RT_AFTER="$(date +%s.0)" + #__RESH_TZ_AFTER=$(date +%:z) + __RESH_TZ_AFTER=2:00 __RESH_PWD_AFTER="$PWD" if [ ! -z ${__RESH_COLLECT+x} ]; then resh-collect -cmdLine "$__RESH_CMDLINE" -exitCode "$__RESH_EXIT_CODE" \