aboutsummaryrefslogblamecommitdiff
path: root/v2/src/bin/collections
blob: 0a8e1563292a922cba5ad1e9e5f35b0a2b84839e (plain) (tree)





























                                                                         

                            




































                                 
#!/bin/sh
set -eu

usage() {
	cat <<-'EOF'
		Usage:
		  collections
		  collections -h
	EOF
}

help() {
	cat <<-'EOF'


		Options:
		  -h, --help    show this message


		List the registered collections to STDOUT.

		This is done by emiting the content of the "$COLLECTIONS"
		environment variable.


		Examples:

		  Just run it:

		    $ collections
		    til
		    pastebin
	EOF
}


for flag in "$@"; do
	case "$flag" in
		--)
			break
			;;
		--help)
			usage
			help
			exit
			;;
		*)
			;;
	esac
done

while getopts 'h' flag; do
	case "$flag" in
		h)
			usage
			help
			exit
			;;
		*)
			usage >&2
			exit 2
	esac
done
shift $((OPTIND - 1))


echo "$COLLECTIONS" |
	tr ' ' '\n' |
	grep .