m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-20 01:23:43 -05:00

Buku examples to select and mass update, open or edit. tested on Ubuntu, zsh and bash compatible

Nanda Lopes
2021-03-28 19:41:19 -03:00
parent 34901fdabc
commit fe5153e69f

@@ -1495,18 +1495,54 @@ function drmi() {
### buku ### buku
Search and open website bookmarks stored in a [buku](https://github.com/jarun/Buku) database. Search and open website bookmarks stored in a [buku](https://github.com/jarun/Buku) database.
```sh ```sh
# BUKU bookmark manager
# get bookmark ids
get_buku_ids() {
buku -p -f 5 | fzf --tac --layout=reverse-list -m | \
cut -d $'\t' -f 1
# awk -F= '{print $1}'
# cut -d $'\t' -f 1
}
# buku open
fb() { fb() {
# save newline separated string into an array # save newline separated string into an array
mapfile -t website <<< "$(buku -p -f 5 | column -ts$'\t' | fzf --multi)" ids=( $(get_buku_ids) )
# open each website echo buku --open ${ids[@]}
for i in "${website[@]}"; do
index="$(echo "$i" | awk '{print $1}')" [[ -z $ids ]] && return 1 # return error if has no bookmark selected
buku -p "$index"
buku -o "$index" buku --open ${ids[@]}
}
# buku update
fbu() {
# save newline separated string into an array
ids=( $(get_buku_ids) )
echo buku --update ${ids[@]} $@
[[ -z $ids ]] && return 0 # return if has no bookmark selected
buku --update ${ids[@]} $@
}
# buku write
fbw() {
# save newline separated string into an array
ids=( $(get_buku_ids) )
# print -l $ids
# update websites
for i in ${ids[@]}; do
echo buku --write $i
buku --write $i
done done
} }
``` ```
...And a nicer looking alternative, using [fzfmenu](#fzf-as-dmenu-replacement). ...And a nicer looking alternative, using [fzfmenu](#fzf-as-dmenu-replacement).