Skip to content

Commit

Permalink
Improved syntax highlighting (#34)
Browse files Browse the repository at this point in the history
* highlight opcode rather than entire usage

* module name change

* reset module
  • Loading branch information
pygrum authored Nov 23, 2023
1 parent ed93fae commit 973f978
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion highlighter.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ func (c *Console) highlightCommand(done, args []string, _ *cobra.Command) ([]str

// Highlight the root command when found, or any of its aliases.
for _, cmd := range c.activeMenu().Commands() {
cmdFound := cmd.Use == strings.TrimSpace(args[0])
// Change 1: Highlight based on first arg in usage rather than the entire usage itself
cmdFound := strings.Split(cmd.Use, " ")[0] == strings.TrimSpace(args[0])

for _, alias := range cmd.Aliases {
if alias == strings.TrimSpace(args[0]) {
Expand Down

0 comments on commit 973f978

Please sign in to comment.