Skip to content

Fixing buku_run #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions buku_run
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ main () {
HELP="Welcome to Buku. Use <span color='${help_color}'>${new_bookmark}</span> to add a new Bookmark
Use <span color='${help_color}'>${switch_view}</span> to switch View. <span color='${help_color}'>${actions}</span> for actions"
if [[ $mode == "bookmarks" ]]; then
content=$(buku -p -f 2 | awk 'NF == 2 { $0 = $0 "NOTAG" }; { $2 = substr($2,0,80); print $1"\t"$2"\t"$3 }' | column -t -s $'\t')
content=$(buku --noprompt -p -f 2 | awk 'NF == 2 { $0 = $0 "NOTAG" }; { $2 = substr($2,0,80); print $1"\t"$2"\t"$3 }' | column -t -s $'\t')
menu=$(echo "${content}" | _rofi -p '> ' -filter "${filter}" -mesg "${HELP}" -kb-custom-1 "${new_bookmark}" -kb-custom-2 "${switch_view}" -kb-custom-3 "${actions}")
elif [[ $mode == "tags" ]]; then
menu=$(buku --st | awk '{ print substr($0, index($0,$2)) }' | _rofi -p '> ' -mesg "${HELP}" -kb-custom-1 "${new_bookmark}" -kb-custom-2 "${switch_view}" -kb-custom-3 "${actions}")
menu=$(buku --noprompt --st | sed 's/[^ ]* //' | awk -F'(' '{ print $1 }' | awk -F'.' '{ print substr($NF,2,length($NF)) }' | _rofi -p '> ' -mesg "${HELP}" -kb-custom-1 "${new_bookmark}" -kb-custom-2 "${switch_view}" -kb-custom-3 "${actions}")
fi
val=$?
if [[ $val -eq 1 ]]; then
Expand All @@ -65,7 +65,7 @@ Use <span color='${help_color}'>${switch_view}</span> to switch View. <span colo
if [[ $mode == "bookmarks" ]]; then
id=$(echo "${menu%% *}")
for bm in ${id}; do
buku -o "${bm}"
buku --noprompt -o "${bm}"
done
elif [[ $mode == "tags" ]]; then
filter="${menu}" mode="bookmarks" main
Expand Down Expand Up @@ -107,7 +107,7 @@ optionsMenu () {
if [[ $newtag == "" ]]; then
mode=tags main
else
buku -r "${menu}" "${newtag}"
buku --noprompt -r "${menu}" "${newtag}"
mode=tags main
fi
fi
Expand All @@ -118,7 +118,7 @@ optionsMenu () {
exit
elif [[ $val -eq 0 ]]; then
if [[ $delask == "1. Yes" ]]; then
buku -r "${menu}"
buku --noprompt -r "${menu}"
mode=tags main
elif [[ $delask == "2. No" ]]; then
mode=tags main
Expand All @@ -137,7 +137,7 @@ deleteMenu () {
exit
elif [[ $val -eq 0 ]]; then
if [[ $delask == "1. Yes" ]]; then
buku -d ${id}
buku --noprompt -d ${id}
mode=bookmarks main
elif [[ $delask == "2. No" ]]; then
optionsMenu
Expand Down Expand Up @@ -173,7 +173,7 @@ editTags () {
if [[ $val -eq 1 ]]; then
exit
elif [[ $val -eq 0 ]]; then
buku -u ${id} --tag ${edittagsmenu}
buku --noprompt -u ${id} --tag ${edittagsmenu}
fi
mode=bookmarks main
}
Expand All @@ -185,7 +185,7 @@ editBookmark () {
exit
elif [[ $val -eq 0 ]]; then
if [[ $bmarkmenu == "http"* ]]; then
buku -u "${id}" --url "${bookmark}"
buku --noprompt -u "${id}" --url "${bookmark}"
else
echo "" | rofi -e "Not a valid URI, Make sure URLs start with http"
editBookmark
Expand All @@ -204,7 +204,7 @@ addMark () {
}

addTags () {
inserttags=$(buku --st | awk '{ print $2 }' | _rofi -p '> ' -mesg "Add some tags. Separate tags with ', '")
inserttags=$(buku --noprompt --st | awk '{ print $2 }' | _rofi -p '> ' -mesg "Add some tags. Separate tags with ', '")
val=$?
if [[ $val -eq 1 ]]; then
exit
Expand All @@ -219,10 +219,11 @@ addTags () {
tags=${inserttags}
fi
if [[ $1 == "--update" ]]; then
buku -u "${id}" --tag ${tags}
buku --noprompt -u "${id}" --tag ${tags}
else
buku -a ${inserturl} ${tags}
buku --noprompt -a ${inserturl} ${tags}
fi
fi
mode=bookmarks main
}
mode=bookmarks main