-
-
Save thash/865c36bb5c03786213c6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/zsh | |
sqlite_file="$(find $HOME/Library/Application\ Support/Firefox/Profiles/*.default/places.sqlite)" | |
if [ ! -e "$sqlite_file" ]; then | |
echo "cannot find sqlite file"; return | |
fi | |
sql="SELECT b.title, p.url FROM moz_bookmarks as b, moz_places as p \ | |
WHERE b.type = 1 \ | |
AND b.title IS NOT NULL \ | |
AND b.fk = p.id \ | |
AND p.url NOT LIKE 'place:%' \ | |
ORDER BY b.lastModified;" | |
# placeの方がちゃんとしたURLかどうか見ないとフォルダかbookmarkかわからん | |
sql="SELECT b.fk FROM moz_bookmarks as b, moz_places as p \ | |
WHERE b.type = 1 \ | |
AND b.title IS NOT NULL \ | |
AND b.fk = p.id \ | |
AND p.url NOT LIKE 'place:%';" | |
sql="SELECT b.fk FROM moz_bookmarks as b, moz_places as p \ | |
WHERE b.type = 1 \ | |
AND b.title IS NOT NULL \ | |
AND b.fk = p.id \ | |
AND p.url NOT LIKE 'place:%' \ | |
ORDER BY b.lastModified;" | |
# fks="$(sqlite3 $sqlite_file "$sql" | tr '\n' ' ')" | |
for fk in `sqlite3 $sqlite_file "$sql"` | |
do | |
sql="SELECT * FROM moz_bookmarks as b \ | |
WHERE b.fk = $fk \ | |
AND title IS NULL;" | |
sqlite3 $sqlite_file "$sql" | |
echo "---" | |
done | |
# sqlite3 $sqlite_file "$sql" | |
# selections="$(sqlite3 $sqlite_file "$sql" | fzf --multi)" | |
# if [ "$selections" = "" ]; then; return; fi | |
# | |
# echo $selections | |
# echo $selections | awk -F '|' '{print $(NF)}' | xargs open -a Firefox |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment