Add an `-l' option to just list URLs without invoking dmenu nor plumb. - plumb - Open certain URL patterns with an ad-hoc opener (plumber)
 (HTM) hg clone https://bitbucket.org/iamleot/plumb
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
       ---
 (DIR) changeset 81f9df542fe0a316c743edceda02dcde52a80aa3
 (DIR) parent 587af00a080cebb615f199b3ae13a40a205da889
 (HTM) Author: Leonardo Taccari <iamleot@gmail.com>
       Date:   Mon, 26 Mar 2018 11:11:36 
       
       Add an `-l' option to just list URLs without invoking dmenu nor plumb.
       
        - Add getopts parsing
        - Add an `-l' option to list filtered and extracted URLs without invoking dmenu
          nor plumb
        - Add an usage() function to print dplumb usage information
       
       Diffstat:
        dplumb |  39 ++++++++++++++++++++++++++++++++-------
        1 files changed, 32 insertions(+), 7 deletions(-)
       ---
       diff -r 587af00a080c -r 81f9df542fe0 dplumb
       --- a/dplumb    Mon Mar 26 11:02:47 2018 +0200
       +++ b/dplumb    Mon Mar 26 11:11:36 2018 +0200
       @@ -32,6 +32,17 @@
        
        
        #
       +# Print usage information and exit.
       +#
       +usage()
       +{
       +       echo "usage: $0 [-l] [url ...]"
       +
       +       exit 1
       +}
       +
       +
       +#
        # Put a signe word in a line.
        #
        one_word_per_line()
       @@ -82,17 +93,31 @@
        #
        # dplumb, dmenu interface for plumb
        #
       -# Process the stdin, extract URLs, pass them to ${PLUMB_DMENU} and open the
       -# selected one to plumb.
       +# Process the stdin, extract URLs, and list or pass them to ${PLUMB_DMENU}
       +# and open the selected one to plumb.
        #
        main()
        {
        
       -       plumb "$(
       -           one_word_per_line |
       -           urlize |
       -           extract_urls |
       -           ${PLUMB_DMENU} )"
       +       while getopts l f; do
       +               case $f in
       +                       l) dplumb_list=yes ;;
       +                       ?) usage;;
       +               esac
       +       done
       +       shift $((OPTIND - 1))
       +
       +       if [ "$dplumb_list" = "yes" ]; then
       +               one_word_per_line |
       +               urlize |
       +               extract_urls
       +       else
       +               plumb "$(
       +                   one_word_per_line |
       +                   urlize |
       +                   extract_urls |
       +                   ${PLUMB_DMENU} )"
       +       fi
               
               exit 0
        }