Skip to content

Commit

Permalink
Allows custom plugins to pop in completion with standalone projects
Browse files Browse the repository at this point in the history
  • Loading branch information
nkakouros committed Feb 16, 2019
1 parent 292e080 commit d91b75e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion lib/internal/complete
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ [email protected]_top_level_commands() {
[email protected]_builtin 'commands'
else
printf 'help\n'
[email protected]_builtin 'commands' "$_GO_SCRIPTS_DIR"

local plugins_paths
printf -v plugins_paths '%s:' "${_GO_PLUGINS_PATHS[@]}"
plugins_paths="${plugins_paths%:}"
[email protected]_builtin 'commands' "$_GO_SCRIPTS_DIR:$plugins_paths"
fi
}

Expand Down
4 changes: 2 additions & 2 deletions tests/complete.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down

0 comments on commit d91b75e

Please sign in to comment.