diff options
author | sinanmohd <sinan@firemail.cc> | 2023-06-30 12:15:42 +0530 |
---|---|---|
committer | sinanmohd <sinan@firemail.cc> | 2023-06-30 12:25:50 +0530 |
commit | f432246cdd3a1a042acdaa0f6696730b98991f41 (patch) | |
tree | 0aab49a76d5b9043cd5742ac7b83d233072fdb2a /bin/vtoc.sh | |
parent | aa4ab18ee326642e1cce408eb1b9a062e0a0960c (diff) |
vtoc: add usage and -h option
Diffstat (limited to 'bin/vtoc.sh')
-rwxr-xr-x | bin/vtoc.sh | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/bin/vtoc.sh b/bin/vtoc.sh index fc69122..599e6ac 100755 --- a/bin/vtoc.sh +++ b/bin/vtoc.sh @@ -1,5 +1,16 @@ #!/bin/sh +usage() +{ + cat <<- EOF + Usage: ${0##*/} [options] [ contacts.vcf ] + convert vcf file to csv file + Options: + -h show this help cruft + + EOF +} + die() { : "${1:?}" @@ -23,9 +34,11 @@ no= vcf= nos= -if [ -z "$1" ] || - [ "$(file --brief --dereference --mime-type "$1")" != "text/vcard" ]; then - die "no or invalid input" +if [ -z "$1" ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then + usage + exit +elif [ "$(file --brief --dereference --mime-type "$1")" != "text/vcard" ]; then + die "input is not a vcf file" else vcf="$1" shift |