diff options
author | Julio Capote <jcapote@gmail.com> | 2022-08-21 15:52:45 +0000 |
---|---|---|
committer | Julio Capote <jcapote@gmail.com> | 2022-08-21 15:52:45 +0000 |
commit | 76b80294047d05360e8069f5c397c9850674cd54 (patch) | |
tree | 1460ea0e30c607128203be16bb76e2c0aec79fa8 /libexec/recit-add-project | |
parent | c24cc0f4ef43be035cf31116c46904f723b5607f (diff) | |
download | recit-76b80294047d05360e8069f5c397c9850674cd54.tar.gz |
add getopts to add-project
Diffstat (limited to 'libexec/recit-add-project')
-rwxr-xr-x | libexec/recit-add-project | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/libexec/recit-add-project b/libexec/recit-add-project index aa60b9e..2f30607 100755 --- a/libexec/recit-add-project +++ b/libexec/recit-add-project @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Usage: recit add-project "notes" +# Usage: recit add-project -n my-project # Summary: Add Project @@ -8,4 +8,22 @@ source lib/loader recfile=$(load_recit) -recins --verbose -f Id -v "$1" -t Project "${recfile}"
\ No newline at end of file +name="" +while getopts "n:" options; do + case "${options}" in + n) + name=${OPTARG} + ;; + :) + echo "Error: -${OPTARG} requires an argument." + exit 1 + ;; + *) + exit 1 + ;; + esac +done + +fmt_date=$(date '+%Y-%m-%d %r') + +recins --verbose -f Id -v "$name" -f Status -v "open" -f Created -v "$fmt_date" -t Project "${recfile}"
\ No newline at end of file |