Skip to content

Commit 5442aaf

Browse files
committed
Added template name completion
1 parent d6fa33a commit 5442aaf

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed

completion/Taskfile.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ tasks:
2828
- "itkdev-docker-compose sync:"
2929
- "itkdev-docker-compose templa"
3030
- "itkdev-docker-compose template:install -"
31+
- "itkdev-docker-compose template:install "
3132
task: completely
3233
vars:
3334
TASK_ARGS: test '{{.ITEM}}'

completion/itkdev-docker-compose-completion.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ _itkdev-docker-compose_completions() {
5151

5252
case "$compline" in
5353
'template:install'*)
54-
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_itkdev-docker-compose_completions_filter "--force --list")" -- "$cur")
54+
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_itkdev-docker-compose_completions_filter "--force --list $(itkdev-docker-compose template:install --list-compact 2>/dev/null)")" -- "$cur")
5555
;;
5656

5757
'template:update'*)

completion/itkdev-docker-compose.completely.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ itkdev-docker-compose:
8484
- template:install:
8585
- --force
8686
- --list
87+
- $(itkdev-docker-compose template:install --list-compact 2>/dev/null)
8788

8889
# template:update [--force]
8990
# Update template installed in project.

scripts/itkdev-docker-compose

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ function self_update {
5151
function template_install {
5252
local force=0
5353
local list=0
54+
local list_compact=0
5455
local name=""
5556

5657
for var in "$@"
@@ -62,6 +63,9 @@ function template_install {
6263
--list)
6364
list=1
6465
;;
66+
--list-compact)
67+
list_compact=1
68+
;;
6569
*)
6670
name="$var"
6771
;;
@@ -72,6 +76,14 @@ function template_install {
7276
local source_dir=$templates_dir/$name/
7377
local target_dir=$PWD
7478

79+
if [ "$list_compact" -eq 1 ]; then
80+
for name in $(find "$templates_dir" -mindepth 1 -maxdepth 1 -type d | sort --version-sort); do
81+
echo -n "$(basename $name) "
82+
done
83+
echo
84+
exit 0
85+
fi
86+
7587
if [ "$list" -eq 1 ]; then
7688
echo Templates:
7789
for name in $(find "$templates_dir" -mindepth 1 -maxdepth 1 -type d | sort --version-sort); do

0 commit comments

Comments
 (0)