Prevent using dossier without a set collection - dossier - console collection manager
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) Tags
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit a72bf72bb01449348914ed85400e6424bf7c838b
 (DIR) parent c40faa46c5be77e015efa65ccc8d1a08995b6e33
 (HTM) Author: Solene Rapenne <solene@perso.pw>
       Date:   Thu,  2 Aug 2018 21:04:51 +0200
       
       Prevent using dossier without a set collection
       
       Diffstat:
         M dossier                             |      21 ++++++++++++++-------
       
       1 file changed, 14 insertions(+), 7 deletions(-)
       ---
 (DIR) diff --git a/dossier b/dossier
       @@ -297,10 +297,23 @@ register() {
                fi
        }
        
       +
       +# commands not requiring a repository set
       +if [ "$1" = "help" ]                 ; then usage ; fi
       +
       +if [ "$1" = "collections" ]; then
       +        if [ "$#" -eq 1 ]; then collections ; fi
       +        if [ "$#" -eq 2 ]; then switch "$2" ; fi
       +        if [ "$2" = "register" ] && [ "$#" -eq 4 ]; then register "$3" "$4" ; fi
       +fi
       +
       +# quit if CONTEXT is not set
       +test -n "$CONTEXT" || exit 10
       +
       +
        if [ "$1" = "import" ] && [ -f "${OLDPWD}/${2}" ]; then import_csv "${OLDPWD}/${2}" ; fi
        if [ "$1" = "export" ] ; then export_csv ; fi
        if [ "$1" = "rm" ] && [ "$#" -eq 2 ] ; then delete "$2" ; fi
       -if [ "$1" = "help" ]                 ; then usage ; fi
        
        # dealing with identifiers
        if [ "$1" = "show" ]
       @@ -324,12 +337,6 @@ then
            if [ "$#" -ge 3 ]; then search_value "$@" ; fi
        fi
        
       -if [ "$1" = "collections" ]; then
       -        if [ "$#" -eq 1 ]; then collections ; fi
       -        if [ "$#" -eq 2 ]; then switch "$2" ; fi
       -        if [ "$2" = "register" ] && [ "$#" -eq 4 ]; then register "$3" "$4" ; fi
       -fi
       -
        if [ "$#" -ge 3 ]; then add_value "$@" ; fi
        
        # no command, maybe it's an item, try it