mirror of
https://github.com/DictXiong/dotfiles.git
synced 2026-10-23 05:08:16 +08:00
install.sh: -H|--hist|--history
This commit is contained in:
26
tools/append_zsh_hist.sh
Executable file
26
tools/append_zsh_hist.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd )
|
||||
source "$THIS_DIR/common.sh"
|
||||
|
||||
zsh_hist_file="$HOME/.zsh_history"
|
||||
|
||||
do_append()
|
||||
{
|
||||
timestamp=$(date +%s)
|
||||
while read -r line; do
|
||||
echo ": $timestamp:0;$line" >> "$zsh_hist_file"
|
||||
done
|
||||
}
|
||||
|
||||
main()
|
||||
{
|
||||
key=$1
|
||||
if [[ -z "$key" ]]; then
|
||||
fmt_fatal "missing key"
|
||||
fi
|
||||
local url="https://pastebin.com/raw/$key"
|
||||
curl -fsSL "$url" | do_append
|
||||
}
|
||||
|
||||
main "${GOT_OPTS[@]}"
|
||||
@@ -48,7 +48,8 @@ test `git rev-parse HEAD` = `curl -fsSL https://api.beardic.cn/get-var/dfs-commi
|
||||
git reset --hard $DFS_VERSION
|
||||
|
||||
# then check install.sh
|
||||
./install.sh -dx DFS_CI=1
|
||||
./install.sh -dx DFS_CI=1 -H e153a2eL
|
||||
grep -q "testhist 1" ~/.zsh_history
|
||||
grep -q "DFS_CI=1" ~/.config/dotfiles/env
|
||||
./install.sh -l -x DFS_CI=1
|
||||
dfs version
|
||||
|
||||
Reference in New Issue
Block a user