Documentation
¶
Overview ¶
Package completion generates shell tab-completion scripts for gitmap.
dynamic.go — context-aware tab-completion helper (#14).
Shells invoke `gitmap __complete <cword> <args...>` and read newline-separated suggestions from stdout. The static command list (allcommands_generated.go) is widened with:
- repo path completions for cd/clone/reclone-class commands (directories under cwd that look like a git repo).
- profile-name completions for chrome-profile-* commands (sourced from Chrome `Local State`, falling back to dir names).
- version completions for visibility / make-* / find-next (sourced from the OwnerRepoNameIndex SQLite table when present).
The runtime helper is intentionally I/O-light: each branch returns in O(few dozen filesystem entries) so completion stays snappy.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllCommands ¶
func AllCommands() []string
AllCommands returns every command name and alias offered by tab-completion.
The list is the union of generatedCommands (auto-extracted from the constants package by internal/gencommands) and manualExtras. Run `go generate ./completion/...` after adding new Cmd* constants to refresh the generated portion.
func DetectShell ¶
func DetectShell() string
DetectShell returns the current shell type based on environment.
func Dynamic ¶
Dynamic returns suggestions for the given argv slice. `cword` is the index of the word being completed (0-based, excluding the `gitmap` binary itself). When no specialized handler matches it falls back to the static command list filtered by prefix.
func InstallCDFunction ¶
InstallCDFunction writes the gitmap/gcd shell wrapper to user profiles.
Types ¶
This section is empty.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
internal
|
|
|
gencommands
command
Command gencommands generates allcommands_generated.go by extracting every Cmd* string constant from constants files in the sibling constants/ package that have explicitly opted into completion via marker comments.
|
Command gencommands generates allcommands_generated.go by extracting every Cmd* string constant from constants files in the sibling constants/ package that have explicitly opted into completion via marker comments. |