return $lastexit
}
+useage()
+{
+ echo "NAME"
+ echo " albentohandy - convert flac to ogg, mp3, opus or flac from music collection"
+ echo "SYNOPSIS"
+ echo " albentohandy [-3fho]"
+ echo "OPTIONS"
+ echo " -3 convert to mp3"
+ echo " -f convert to flac with cover"
+ echo " -h show this usage"
+ echo " -o convert to opus"
+}
+
check_programs()
{
command -v rsync > /dev/null \
check_programs || return $?
load_config || return $?
- while getopts "3fi:o" opt; do
+ while getopts "3fhi:o" opt; do
case "$opt" in
"3") lib="mp3.sh" ;;
"f") lib="flac.sh" ;;
+ "h") useage && return 0 ;;
"i") albumlist="$OPTARG" ;;
"o") lib="opus.sh" ;;
*) errlog "unknown option" && return 1 ;;
assert_equal "$(awk 'NR==2 {print; exit}' "build/tests/output/checksum.sha256")" "5ca47f5787b6cba8809184876e8557f8650d92c2b7c63a03d1a9b9aa352f7aae ./Artist1/Album1/02.ogg"
assert_equal "$(awk 'NR==3 {print; exit}' "build/tests/output/checksum.sha256")" "1aaea6c72ae66ce6bd36cd08fb511565a34179780d68166515a9f045652088c2 ./Artist1/Album1/bla.ogg"
assert_equal "$(awk 'NR==4 {print; exit}' "build/tests/output/checksum.sha256")" "96af1c6d5c863aef68cabe54aefc2342e66a9cf6b5663660f2ea8cea86e9f5ce ./Artist1/Album1/blub.ogg"
+}
+
+# bats test_tags=albentohandy:usage
+@test "success: print usage" {
+ run main -h
+
+ assert_success
+ assert_line --index 0 "NAME"
+ assert_line --index 1 " albentohandy - convert flac to ogg, mp3, opus or flac from music collection"
+ assert_line --index 2 "SYNOPSIS"
+ assert_line --index 3 " albentohandy [-3fho]"
+ assert_line --index 4 "OPTIONS"
+ assert_line --index 5 " -3 convert to mp3"
+ assert_line --index 6 " -f convert to flac with cover"
+ assert_line --index 7 " -h show this usage"
+ assert_line --index 8 " -o convert to opus"
}
\ No newline at end of file