From d91b75e9de4993f88331ad8fffe205c4cb366389 Mon Sep 17 00:00:00 2001 From: Nikolaos Kakouros Date: Sat, 16 Feb 2019 14:27:54 +0100 Subject: [PATCH] Allows custom plugins to pop in completion with standalone projects --- lib/internal/complete | 6 +++++- tests/complete.bats | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/internal/complete b/lib/internal/complete index a187dd3..3390909 100644 --- a/lib/internal/complete +++ b/lib/internal/complete @@ -6,7 +6,11 @@ _@go.complete_top_level_commands() { _@go.source_builtin 'commands' else printf 'help\n' - _@go.source_builtin 'commands' "$_GO_SCRIPTS_DIR" + + local plugins_paths + printf -v plugins_paths '%s:' "${_GO_PLUGINS_PATHS[@]}" + plugins_paths="${plugins_paths%:}" + _@go.source_builtin 'commands' "$_GO_SCRIPTS_DIR:$plugins_paths" fi } diff --git a/tests/complete.bats b/tests/complete.bats index a77c0d6..256bda9 100644 --- a/tests/complete.bats +++ b/tests/complete.bats @@ -45,13 +45,13 @@ teardown() { assert_failure '' } -@test "$SUITE: _GO_STANDALONE only completes 'help' and project scripts" { +@test "$SUITE: _GO_STANDALONE only completes 'help' and custom scripts/plugins" { @go.create_test_command_script 'foo' @go.create_test_command_script 'bar' @go.create_test_command_script 'plugins/baz/bin/baz' _GO_STANDALONE='true' run "$TEST_GO_SCRIPT" complete 0 - assert_success 'help' 'bar' 'foo' + assert_success 'help' 'bar' 'baz' 'foo' } @test "$SUITE: cd and pushd complete directories" {