tldr-pages / tldr

📚 Collaborative cheatsheets for console commands
https://tldr.sh
Other
50.36k stars 4.11k forks source link

Client option to display short options instead of long options #5092

Open bl-ue opened 3 years ago

bl-ue commented 3 years ago

I was just about to go through and convert all examples that use short options to long options (if available for each command), when I thought of a cool idea to add a option to all clients to display short options in examples if the user specifies, instead of long options. In the markdown, we would need some new syntax to store short and long options, I was thinking something like this:

- Description:

`cmd {[-l|--long-option]} {{param}}

And running tldr:

$ tldr cmd
  ...

  cmd -l param

$ tldr cmd -s
  ...

  cmd --long-option param

One obviously useful application of this idea would be rg. It has --no-ignore --hidden --binary and a short form -uuu. The syntax to store those in the markdown might be {[-uuu|--no-ignore --hidden --binary]}.

@tldr-pages What do you think?

sbrl commented 3 years ago

Hrm, an interesting thought, but I'm wary of adding additional complexities to custom syntax - especially in the syntax for a command. Generally the rule of thumb at the moment is to use short options on commands a user will be using a lot (e.g. ls), and long options for everything else. The [c]reate convention is also used in places too. Maybe that would be worth applying to the ripgrep/rg page.