Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allows custom plugins to pop up during completion with standalone projects #251

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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