3 #==============================================================================
5 # File ID: de561b1e-1d18-11e7-9fd8-db5caa6d21d3
7 # Create and start a new task in Taskwarrior.
9 # Author: Øyvind A. Holm <sunny@sunbase.org>
10 # License: GNU General Public License version 2 or later.
11 #==============================================================================
19 while test -n "$1"; do
21 -h|
--help) opt_help
=1; shift ;;
22 -q|
--quiet) opt_quiet
=$
(($opt_quiet + 1)); shift ;;
23 -v|
--verbose) opt_verbose
=$
(($opt_verbose + 1)); shift ;;
24 --version) echo $progname $VERSION; exit 0 ;;
27 if printf '%s\n' "$1" |
grep -q ^
-; then
28 echo "$progname: $1: Unknown option" >&2
36 opt_verbose
=$
(($opt_verbose - $opt_quiet))
38 if test "$opt_help" = "1"; then
39 test $opt_verbose -gt 0 && { echo; echo $progname $VERSION; }
42 Create and start a new task in Taskwarrior.
44 Usage: $progname [options] DESCRIPTION
51 Be more quiet. Can be repeated to increase silence.
53 Increase level of verbosity. Can be repeated.
55 Print version information.
62 echo $progname: No description provided
>&2
66 t
--is-active ||
exit 1
68 tmpfile
="/tmp/cts.$(date +%s.$$).tmp"
70 t add
"$@" |
tee "$tmpfile"
72 grep ^Created
"$tmpfile" | \
73 perl
-pe 's/^Created task (\d+).*$/$1/;'
75 if test -z "$eid"; then
76 echo $progname: Could not get entry ID value
>&2
77 echo $progname: Leaving tmpfile as
$tmpfile >&2
84 # vim: set ts=8 sw=8 sts=8 noet fo+=w tw=79 fenc=UTF-8 :