aboutsummaryrefslogtreecommitdiff
path: root/ctct.in
diff options
context:
space:
mode:
Diffstat (limited to 'ctct.in')
-rw-r--r--ctct.in16
1 files changed, 12 insertions, 4 deletions
diff --git a/ctct.in b/ctct.in
index 93c5ff2..ef7b588 100644
--- a/ctct.in
+++ b/ctct.in
@@ -38,6 +38,9 @@ test -f "$user_config_dir/config.sh" \
## CONSTANTS:
exec_name="${0##*/}"
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+EXIT_ERROR=2
TRUE=0
FALSE=1
@@ -47,8 +50,8 @@ cat << EOF
usage:
$exec_name <name> - show contact
$exec_name -l - list all entries
- $exec_name [-s] <part> [...] - search by name
- $exec_name -S <part> [...] - search by data
+ $exec_name -s <pattern> [...] - search by name
+ $exec_name -S <regex> [...] - search by data
$exec_name -e <name> - edit / create entry
$exec_name -d <name> [...] - delete entries
$exec_name --rename <old> <new> - rename entry
@@ -107,7 +110,12 @@ function main()
( test $# -lt 3 && print_error "$exec_name: no new name specified." ) \
&& exit 1
rename_file "$2" "$3"; exit $?
- elif [[ "$1" =~ ^- ]]; then
+ elif [[ "$1" == '--' ]]
+ then
+ shift 1
+ test $# -eq 0 && print_help && exit 1
+ elif [[ "$1" =~ ^- ]]
+ then
print_error "$exec_name: unknown option '$1'"; exit 1
fi
@@ -116,8 +124,8 @@ function main()
if ! find_similar "Did you mean:" "$@"
then
print_msg "No match found."
- return 1
fi
+ return 1
fi
}