aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2018-02-12 22:57:29 +0100
committerTeddy Wing2018-02-12 22:57:29 +0100
commit2ec7252024d85620611a1834b298308ec6179f02 (patch)
treebcc087b5d985c5300f4ca3ca160ff2bb2a3cdd45
parentb25764a4bfc9cdc79db7baa707c58ee32c510347 (diff)
downloadharvester-2ec7252024d85620611a1834b298308ec6179f02.tar.bz2
harvester: Implement the `--list-modules` flag
When given with a project (project must come first in the argument list), a list of all the modules (known as "tasks" in Harvest speak) will be printed to the console, filtered from a list fetched by 'hcl'. With no project argument, all tasks for all projects will be printed.
-rwxr-xr-xharvester14
1 files changed, 12 insertions, 2 deletions
diff --git a/harvester b/harvester
index 605ba14..30b2996 100755
--- a/harvester
+++ b/harvester
@@ -56,6 +56,15 @@ function hcl_log () {
hcl log "$date" "@${project}" "$time" "$description"
}
+function list_modules () {
+ local project="$1"
+
+ local project_id=$(grep "$project" $HOME/.hcl/settings.yml |
+ cut -d ' ' -f 2)
+
+ hcl tasks | grep "^${project_id}"
+}
+
function main () {
local project=''
local time='7'
@@ -113,8 +122,9 @@ function main () {
continue
;;
--list-modules)
- shift
- continue
+ list_modules "$project"
+
+ return 0
;;
--help)
print_usage