mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-19 00:53:42 -05:00
Buku examples to select and mass update, open or edit. tested on Ubuntu, zsh and bash compatible
48
Examples.md
48
Examples.md
@@ -1495,18 +1495,54 @@ function drmi() {
|
||||
|
||||
### buku
|
||||
Search and open website bookmarks stored in a [buku](https://github.com/jarun/Buku) database.
|
||||
|
||||
```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() {
|
||||
# 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
|
||||
for i in "${website[@]}"; do
|
||||
index="$(echo "$i" | awk '{print $1}')"
|
||||
buku -p "$index"
|
||||
buku -o "$index"
|
||||
echo buku --open ${ids[@]}
|
||||
|
||||
[[ -z $ids ]] && return 1 # return error if has no bookmark selected
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
...And a nicer looking alternative, using [fzfmenu](#fzf-as-dmenu-replacement).
|
||||
|
||||
Reference in New Issue
Block a user