Skip to content

Suggestion: Leverage clap for native help and man pages while maintaining strict tmux parity #32

@Dailiduzhou

Description

@Dailiduzhou

Hi there! Thanks for building rmux—having a Rust-based alternative to tmux is a fantastic initiative, and I'm really excited about the project's potential.

While exploring the CLI, I noticed that rmux -h perfectly mirrors the output of tmux -h. That is great attention to detail for drop-in parity! However, I also noticed that maintaining this output currently relies on manual string concatenation (like build_implemented_command_help()), and the project's installation scripts don't yet bundle man pages—which are critical for users migrating from tmux.

Since clap is already in the dependency tree, I wanted to suggest migrating the CLI definition entirely to clap's native capabilities.

Potential Benefits

  • Maintaining Parity without Boilerplate: clap allows for overriding the default usage string (e.g., using override_usage or help_template). This means rmux can keep the exact bundled [-2CDhlNuVv] layout for strict tmux compatibility, but eliminate the manual string-building loops in the codebase.
  • Zero-Effort Man Pages: Standardizing on clap unlocks clap_mangen. rmux.1 can be automatically generated during CI/CD builds and bundled into the release archive, allowing install.sh to easily deploy it for users.
  • Shell Completions: It also makes it trivial to generate shell auto-completions via clap_complete, enhancing the user experience.

Questions for the Maintainers

I wanted to open a discussion before touching any code, as I completely understand that custom implementations are often born out of specific needs:

  • Are there specific technical constraints (e.g., binary size optimization, startup latency, or dynamic command registration from a server daemon) that made you lean towards custom help rendering instead of tweaking clap's templates?

If leveraging native clap features aligns with your roadmap for rmux, I would be more than happy to help refactor the CLI logic, set up the man-page generation, and update the install script in a PR. If you prefer to keep the current setup for specific design reasons, please feel free to close this issue.

Thanks again for your awesome work on this project!

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions