Skip to content

feat(install_cloud_clis): lazy-load and cache bash completions#60

Merged
branic merged 2 commits into
mainfrom
feat/lazy-load-bash-completions
Jun 15, 2026
Merged

feat(install_cloud_clis): lazy-load and cache bash completions#60
branic merged 2 commits into
mainfrom
feat/lazy-load-bash-completions

Conversation

@branic

@branic branic commented Jun 13, 2026

Copy link
Copy Markdown
Owner

Summary

  • Replace eager source <(cmd completion bash) calls at shell startup with a _lazy_completion function that defers completion generation to first tab-complete
  • Cache completion output under ~/.cache/bash_completions/ with automatic invalidation when the CLI binary is updated
  • AWS CLI unchanged — it already uses a direct binary completer (complete -C)

Test plan

  • Run the role against a target and verify the managed block in ~/.bashrc contains the _lazy_completion function and one-liner registrations
  • Open a new shell and confirm no completion-related subprocesses spawn at startup
  • Tab-complete a CLI (e.g. oc <tab>) and verify completions load and a cache file appears under ~/.cache/bash_completions/
  • Run the role again and confirm blockinfile reports no changes (idempotency)
  • Run with install_cloud_clis_components: [aws] only and confirm the _lazy_completion function is not emitted

🤖 Generated with Claude Code

branic and others added 2 commits June 12, 2026 17:28
Replace eager `source <(cmd completion bash)` calls with a
`_lazy_completion` function that defers completion generation to first
tab-complete, caches output under ~/.cache/bash_completions/, and
auto-invalidates when the CLI binary is updated.  This eliminates
subprocess spawns at shell startup for ~8 CLIs.

AWS CLI is unchanged — it already uses a direct binary completer.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@branic branic merged commit 7358ef9 into main Jun 15, 2026
48 checks passed
@branic branic deleted the feat/lazy-load-bash-completions branch June 15, 2026 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant