#!/usr/bin/env nix-shell #!nix-shell --pure -i bash -p jq bash -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/fea633695211167753ee732c9087808d0c57461c.tar.gz set -euET -o pipefail usage() { printf "Usage: %q [path/to/.config/chromium/Default/]"\\n "$0" } if test $# -ne 1; then usage exit 1 elif test $# -eq 1 && (test "x$1" = "x-h" || test "x$1" = "x--help"); then usage exit 0 fi if test $# -ge 1; then profile="$1" else # use printf to avoid echo's ambiguity; save trailing whitespace with a dummy x (not needed here as the string ends with "Default", but a good habit nevertheless) profile="$(printf "%sx" ~/.config/chromium/Default/)" profile="${profile%x}" fi jq '.roots[] | recurse(.children?[]?) | "\( .name? ): \( .url? )"' < "$profile"/Bookmarks