2024-11-17 07:07:30 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
NOTES_SH="$(which notes.sh)"
|
|
|
|
|
|
|
|
if [[ -z "$@" ]]; then
|
|
|
|
echo "^n .*$"
|
|
|
|
elif [[ "$1" == "--hint" ]]; then
|
|
|
|
shift
|
|
|
|
elif [[ "$1" == "--complete" ]]; then
|
|
|
|
shift
|
2024-11-23 20:20:58 +00:00
|
|
|
notes.sh -l | tac | awk '{printf("%s n", $1); for (i=2; i<=NF; i++) printf(" %s", $i); print("");}'
|
2024-11-17 07:07:30 +00:00
|
|
|
elif [[ "$1" == "--preview" ]]; then
|
|
|
|
shift
|
|
|
|
notes.sh -p "$1"
|
|
|
|
elif [[ "$1" == "--run" ]]; then
|
|
|
|
shift
|
2024-11-20 07:08:16 +00:00
|
|
|
INPUT="$(echo "$1" | sed 's/^n //g')"
|
|
|
|
|
|
|
|
setsid -f foot "$NOTES_SH" -f "$INPUT" "$2"
|
2024-11-17 07:07:30 +00:00
|
|
|
else
|
|
|
|
echo "Unexpected arguments: $@"
|
|
|
|
fi
|