summaryrefslogtreecommitdiffstats
path: root/cac
diff options
context:
space:
mode:
Diffstat (limited to 'cac')
-rwxr-xr-xcac21
1 files changed, 21 insertions, 0 deletions
diff --git a/cac b/cac
index fa52f92..25029e1 100755
--- a/cac
+++ b/cac
@@ -63,6 +63,7 @@ printf %s $binaryPrefix | tr -d 0 | wc -c
cac_resources_cache=${cac_resources_cache-$HOME/tmp/cac_resources_cache.json}
cac_servers_cache=${cac_servers_cache-$HOME/tmp/cac_servers_cache.json}
+cac_tasks_cache=${cac_tasks_cache-$HOME/tmp/cac_tasks_cache.json}
cac_templates_cache=${cac_templates_cache-$HOME/tmp/cac_templates_cache.json}
cac_secrets=${cac_secrets-$HOME/.secrets/cac}
@@ -128,6 +129,13 @@ __cac_cli__servers() {
jq -r . $cac_servers_cache
}
+#? cac tasks
+#? Print cached tasks JSON.
+#?
+__cac_cli__tasks() {
+ jq -r . $cac_tasks_cache
+}
+
#? cac templates
#? Print cached templates JSON.
#?
@@ -150,6 +158,7 @@ __cac_cli__update() {(
for x in \
resources \
servers \
+ tasks \
templates \
# This line intentionally left blank.
do
@@ -379,6 +388,18 @@ _cac_fetch_servers() {(
fi
)}
+_cac_fetch_tasks() {(
+ res=$(_cac_get_api_v1 listtasks)
+ status=$(echo $res | jq -r .status)
+
+ if [ "$status" = ok ]; then
+ echo "$res" | jq -r .data
+ else
+ echo "cac_fetch_tasks: bad status: $status" >&2
+ exit 1
+ fi
+)}
+
_cac_fetch_templates() {(
res=$(_cac_get_api_v1 listtemplates)
status=$(echo $res | jq -r .status)