Skip to content

Commit

Permalink
[,bm] make search case insensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
meain committed Jan 19, 2024
1 parent 37a2824 commit ce1f16d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/.local/bin/random/,bm
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ add)
;;
pick)
url=$(sqlite3 "$BM_FILE" "$QUERY" |
awk -F'|' "$VIEW_FORMAT" | ,picker |
awk -F'|' "$VIEW_FORMAT" | ,picker -i |
awk '{print $NF}' | cut -d'(' -f2 | cut -d')' -f1)
if [ -n "$url" ]; then
sqlite3 "$BM_FILE" "UPDATE bookmarks SET count=count+1 WHERE url='$url';"
Expand All @@ -43,12 +43,12 @@ pick)
;;
list)
sqlite3 "$BM_FILE" "$QUERY" |
awk -F'|' "$VIEW_FORMAT" | ,picker |
awk -F'|' "$VIEW_FORMAT" | ,picker -i |
awk '{print $NF}' | cut -d'(' -f2 | cut -d')' -f1
;;
remove)
sqlite3 "$BM_FILE" "$QUERY" |
awk -F'|' "$VIEW_FORMAT" | ,picker |
awk -F'|' "$VIEW_FORMAT" | ,picker -i |
awk '{print $NF}' | cut -d'(' -f2 | cut -d')' -f1 |
xargs -r -I{} sqlite3 "$BM_FILE" "DELETE FROM bookmarks WHERE url='{}';"
;;
Expand Down
3 changes: 3 additions & 0 deletions scripts/.local/bin/utils/,picker
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ no_sort=""
query=""
print_query=""
exact=""
ignore_case=""
while [[ "$1" = -* ]]; do
[ "$1" = "-p" ] && shift && prompt="$1" && shift && continue
[ "$1" = "--preview" ] && shift && preview="$1" && shift && continue
Expand All @@ -24,6 +25,7 @@ while [[ "$1" = -* ]]; do
[ "$1" = "--query" ] && shift && query="$1" && shift && continue
[ "$1" = "--print-query" ] && shift && print_query="1" && continue
[ "$1" = "--exact" ] && shift && exact="1" && continue
[ "$1" = "-i" ] && shift && ignore_case="1" && continue
echo "Unknown option $1" && exit 1
done

Expand All @@ -34,6 +36,7 @@ fzf_cmd="fzf"
if [ "$GUI_PICKER" = 1 ]; then
[ -n "$prompt" ] && dmenu_cmd="$dmenu_cmd -p '$prompt'"
[ -n "$lines" ] && dmenu_cmd="$dmenu_cmd -l '$lines'"
[ -n "$ignore_case" ] && dmenu_cmd="$dmenu_cmd -i '$lines'"
eval "$dmenu_cmd"
else
[ -n "$prompt" ] && fzf_cmd="$fzf_cmd --prompt '$prompt'"
Expand Down

0 comments on commit ce1f16d

Please sign in to comment.