Skip to content

FR: Support for Alias Descriptions in Config and Help Output #6359

Open
@rwjblue-glean

Description

@rwjblue-glean

Summary

I'd like to request the ability to add descriptions to custom aliases in the config file, and have these descriptions appear in jj --help and jj help output.

Current Behavior

Currently, my aliases look like this in my config:

[aliases]
# short alias for squash
sq = ["squash"]

# find the nearest bookmark and move it forward to the nearest pushable revision
tug = ["bookmark", "move", "--from", "closest_bookmark(@)", "--to", "closest_pushable(@)"]

When running jj --help, I notice:

  1. Simple aliases to built-in commands like b for bookmark show up as bookmark Manage bookmarks [default alias: b]
  2. My simple alias sq doesn't show up similarly next to the squash command
  3. Custom complex aliases like tug don't show up at all

This creates a real usability issue - for aliases that I use only occasionally (like tug), I often forget their exact semantics so I have to go back and manually review my config.toml file to remind myself what it does. This adds friction to my workflow and makes my custom aliases less useful than they could be.

Proposed Solution

I propose extending the alias configuration format to support descriptions, perhaps like:

[aliases]
sq = { command = ["squash"], description = "Short alias for squash command" }
tug = { 
  command = ["bookmark", "move", "--from", "closest_bookmark(@)", "--to", "closest_pushable(@)"],
  description = "Move nearest bookmark to nearest pushable revision"
}

With this change, the jj --help output could look something like:

Jujutsu (An experimental VCS)

Usage: jj [OPTIONS] <COMMAND>

Commands:
  abandon           Abandon a revision
  bookmark          Manage bookmarks [default alias: b]
  commit            Update the description and create a new change on top
  diff              Compare file contents between two revisions
  squash            Move changes from a revision into another revision [aliases: sq]
  status            Show high-level repo status [aliases: st]
  ...

Custom Aliases:
  tug               Move nearest bookmark to nearest pushable revision

Options:
  -h, --help        Print help (see a summary with '-h')
  ...

Benefits

  1. Simple aliases like sq would be shown next to their commands, similar to how built-in aliases are shown
  2. Complex aliases like tug would get their own section with descriptions
  3. Most importantly, I wouldn't need to go back to my config file every time I forget what an occasionally-used alias does - I could just check the help output

Would this feature be useful to add to jj? I think it would make custom aliases much more integrated into the tool's workflow and reduce the cognitive load of remembering what each alias does.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions