From 72d870b3c1a4f2ef82c8fbd39be563251209bb82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Wed, 8 Dec 2021 16:28:46 -1000 Subject: [PATCH] Add a bolt task to setup shell completion This is a building block that might be used when/if we want to add Bolt tasks / plans to setup Choria on nodes not managed by Puppet, in particular client nodes. Currently our systems administrator manually add the choria repo and install the software, but this is not enough to have shell completion and we might need to update it from time to time. Add a bolt task that make managing the completions easier: ``` bolt task run choria::completion -t localhost --run-as root ``` --- tasks/completion.json | 3 +++ tasks/completion.sh | 11 +++++++++++ 2 files changed, 14 insertions(+) create mode 100644 tasks/completion.json create mode 100644 tasks/completion.sh diff --git a/tasks/completion.json b/tasks/completion.json new file mode 100644 index 0000000..b9eec6d --- /dev/null +++ b/tasks/completion.json @@ -0,0 +1,3 @@ +{ + "description": "Setup choria completion" +} diff --git a/tasks/completion.sh b/tasks/completion.sh new file mode 100644 index 0000000..bd4b075 --- /dev/null +++ b/tasks/completion.sh @@ -0,0 +1,11 @@ +#!/bin/sh +for p in /usr/share/bash-completion /usr/local/etc/bash_completion.d; do + if [ -d "$p" ]; then + choria completion --bash > "$p/choria" + fi +done +for p in /usr/share/zsh/vendor-completions /usr/local/share/zsh/site-functions; do + if [ -d "$p" ]; then + choria completion --zsh > "$p/_choria" + fi +done