1. 18
    1. 4

      Neat!

      Looking at the way browsers are handled, would you consider using xdg-open instead?

      1. 5

        Done:

        if [ "$action" = "view" ]; then
            echo "${url_array[$article]}"
        elif [ "$action" = "read" ]; then
            if [ -n "$BROWSER" ]; then
                "$BROWSER" "${url_array[$article]}"
            elif type -P 'xdg-open'; then
                xdg-open "${url_array[$article]}"
            else
                read -p "Please enter your browser's binary (e.g. firefox -- if it's in your \$PATH), or the full location of the binary (e.g. /opt/firefox/firefox): " browser
                if [[ "$browser" == *"firefox"* ]] || [[ "$browser" == *"palemoon"* ]]; then
                    eval "$browser --new-tab ${url_array[$article]}"
                else
                    eval "$browser ${url_array[$article]}"
                fi	
            fi
        fi
        
        1. 2

          And/or the $BROWSER environment variable. Basically something like this:

          elif [ "$action" = "read" ]; then
          	if [ -n "$BROWSER" ]; then
          		$BROWSER "$url"
          	elif type -P 'xdg-open'; then
          		xdg-open "$url"
          	else
          		read -p "Please enter your browser's binary  " browser
          		[.. trim ..]
          	fi
          fi
          
          1. 1

            I wonder if there’s a standard way to specify the opener binary; something like, export OPEN="$(which xdg-open)" (since not all platforms use xdg-open).

            1. 1

              Not as far as I know; if you use an xdg-open alternative then having some sort of wrapper is probably the best solution.

          2. 1

            Sorry for the late reply, I didn’t notice the time when I posted this and had to do go to sleep pretty much directly after posting.

            I can, I just haven’t yet because I don’t use any XDG stuff. (I’m on Gentoo and don’t want to installs all the deps for it.)

          3. 2

            Nice! FYI, bash also seems to be an unmentioned dependency, but I understand if you like its conveniences!

            1. 2

              Good point, I’ll list bash as well.

            2. 2

              Simple version using the under appreciated http://xmlstar.sourceforge.net/ parsing the rss feed:

              curl -sL https://lobste.rs/rss | xmlstarlet sel -T -t -m "/rss/channel/item" -v title  -o " " -v link -n
              

              My terminal allows me to click links, so I don’t need the number system

              1. 2

                I made an improvement!

                curl -sL https://lobste.rs/rss | xmlstarlet sel -T -t -m "/rss/channel/item" -v title  -o "%%" -v link -n | awk -F "%%" '{print "\033[31;1m" $1 "\033[39;22m" "∑" $2 "\033[0m" }' | column -t -s '∑'
                
                • Color titles red and links white
                • Put them into columns
                • Sigma is the separator because it’s pretty unlikely to appear but I’d love a suggestion on something else.

                Edit: and made it a script in my dotfiles.

                1. 1

                  ah, very nice! great idea with the use of column

                  1. [Comment removed by author]