Run search as the default command

Signed-off-by: Oliver Davies <oliver@oliverdavies.uk>
This commit is contained in:
Oliver Davies 2025-09-21 19:44:09 +01:00
parent a90870a747
commit 7e5afc2193

23
zet
View file

@ -14,16 +14,13 @@ Usage:
zet id QUERY... : Search for a zettel and display its ID
zet print|p QUERY... : Search for a zettel and print it
zet push : Push changes
zet search|s QUERY... : Print IDs and titles of zettels matching QUERY
zet view|v QUERY... : Search for a zettel and view it
zet QUERY... : Print IDs and titles of zettels matching QUERY
EOF
set -o errexit
COMMAND="${1:-}"
shift 1
SELECTED_ZET=''
ZET_DIR=${ZET_DIR:-.}
ZET_LIST=()
@ -132,17 +129,16 @@ get_title_from_file() {
}
main() {
if [[ -z "$COMMAND" ]]; then
show_usage
exit 1
fi
COMMAND="$1"
case "$COMMAND" in
create | c)
shift 1
cmd_create "$@"
;;
edit | e)
shift 1
cmd_edit "$@"
;;
@ -151,10 +147,12 @@ main() {
;;
id)
shift 1
cmd_id "$@"
;;
links | l)
shift 1
cmd_links "$@"
;;
@ -162,18 +160,13 @@ main() {
cmd_push
;;
search | s)
cmd_search "$@"
;;
view | v)
shift 1
cmd_view "$@"
;;
*)
echo "ERROR: $COMMAND"
show_usage
exit 1
cmd_search "$@"
;;
esac
}