From 2ec7252024d85620611a1834b298308ec6179f02 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Mon, 12 Feb 2018 22:57:29 +0100 Subject: 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. --- harvester | 14 ++++++++++++-- 1 file 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 -- cgit v1.2.3