Update 2023-04-06 17:48 OpenBSD/amd64

This commit is contained in:
c0dev0id
2023-04-06 17:48:14 +02:00
parent 1da923cf9d
commit 6dbb2076f6
4 changed files with 31 additions and 52 deletions

View File

@@ -19,23 +19,10 @@ test -f ${HOME}/.bin/_config \
test -f "${HISTFILE}" \
|| touch "${HISTFILE}"
HISTDATA="$(while IFS= read -r l; do echo "${#l} $((++n)) $l"; done \
< "${HISTFILE}" \
| sed 's|/$||;s|http[s]\{0,1\}://||' \
| sort -t\| -k 2 -u \
| sort -n \
| cut -d" " -f3-)"
PICKLIST="paste_from_clipboard
pick_from_history
edit_history_file
-----------------
$(echo "${HISTDATA}" \
| cut -b 23- \
| egrep -v ' |^[^a-zA-Z0-9]' \
| grep '..\...'\
)
http://localhost"
PICKLIST="\
paste_from_clipboard
$(< "${HISTFILE}")
"
# show filtered history file
# EXPECTS: $PICKLIST $HISTFILE $DMENU_CMD
@@ -43,21 +30,11 @@ http://localhost"
read_input() {
local S=$(printf '%s\n' "${PICKLIST}" \
| ${DMENU_CMD} -p "Bookmarks")
case "${S}" in
paste_from_clipboard)
S=$(xclip -o \
| head -n 1) ;;
pick_from_history)
S=$(sort -r "${HISTFILE}" \
| ${DMENU_CMD} -p "History:" \
|cut -b23-) ;;
edit_history_file)
texec "vim +\$ ${HISTFILE}"
dexec_browser
exit 0 ;;
esac
[ -z "${S}" ] && exit 0
INPUT="${S}"
}
@@ -198,8 +175,7 @@ choose_browser() {
}
save_history() {
printf '%s %s\n' "$(date +"%Y-%m-%d %H:%M:%S |")" "${INPUT}" \
>> "${HISTFILE}"
printf '%s\n' "${INPUT}" >> "${HISTFILE}"
}
# main program starts here.