Skip to content

main: add apt-get subcommand highlighting - #981

Open
Iamliuxiaozhen wants to merge 2 commits into
zsh-users:masterfrom
Iamliuxiaozhen:apt
Open

main: add apt-get subcommand highlighting#981
Iamliuxiaozhen wants to merge 2 commits into
zsh-users:masterfrom
Iamliuxiaozhen:apt

Conversation

@Iamliuxiaozhen

Copy link
Copy Markdown

Summary

Add apt-get subcommand recognition to the main highlighter.

This change makes valid apt-get subcommands highlight as commands and
invalid subcommands highlight as unknown-token, matching the existing
behavior for apt.

Changes

  • Add _zsh_highlight_main__is_apt_get_subcommand()
  • Cache the apt-get subcommand list after the first lookup
  • Mark the first argument after apt-get as an apt-get subcommand token
  • Highlight valid subcommands as command
  • Highlight invalid subcommands as unknown-token
  • Add test coverage for valid and invalid apt-get subcommands

Examples

Before:

apt-get install
apt-get isntall

Both subcommands were highlighted as normal arguments.

After:

apt-get install

install is highlighted as a valid command.

apt-get isntall

isntall is highlighted as unknown-token.


---

Detect apt subcommands after runnable apt invocations and mark known
subcommands as commands while styling unknown ones as unknown tokens.

Load apt subcommands lazily from apt help with a built-in fallback list so
highlighting works across apt versions. Add tests for valid and invalid apt
subcommand handling.feat(main): highlight invalid apt subcommands distinctly

Detect apt subcommands after runnable apt invocations and mark known
subcommands as commands while styling unknown ones as unknown tokens.

Load apt subcommands lazily from apt help with a built-in fallback list so
highlighting works across apt versions. Add tests for valid and invalid apt
subcommand handling.
Add apt-get subcommand detection alongside apt handling, including cached
lookup from apt-get help output and fallback built-in subcommands.

Update tests to verify valid apt-get subcommands are highlighted as commands
and invalid ones as unknown tokens.feat(main): highlight apt-get subcommands

Add apt-get subcommand detection alongside apt handling, including cached
lookup from apt-get help output and fallback built-in subcommands.

Update tests to verify valid apt-get subcommands are highlighted as commands
and invalid ones as unknown tokens.
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