mirror of
https://github.com/DictXiong/dotfiles.git
synced 2024-11-28 12:47:01 +08:00
26 lines
483 B
Bash
26 lines
483 B
Bash
|
#!/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[@]}"
|