-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal: mechanism for command aliases #5299
Comments
I like this idea, though this is almost a duplicate of #787. It uses the existing syntax, and doesn't necessitate a client update. It doesn't handle copies of a command across multiple platforms, but this issue was previously resolved by putting anyn pages for commands that are present on more than 1 platform in If this gets a positive response from others, I think we can close both this issue and #787 too. I support! |
Does anyone have a preference of the wording: I prefer the former, as the latter implies that this command is actually a real alias (in the shell sense) to an existing command, but in reality, most 'aliased' commands are either shell scripts which run the original, or, in the more unfortunate cases, duplicate binaries. |
We might need a new label, too, because users may very well add missing aliases. I think we should definitely do that. I think this is a good color: |
Sounds better. Hrm, I'm not sure a new label will really be needed. |
Are you sure? because what if someone opens a new PR just to add an alias. Actually, I think |
I think |
Well, with #5368, I guess we've integrated the system. Here's a test: $ tldr -u
✔ Updating...
✔ Creating index...
$ tldr mscore
mscore
This command is an alias of musescore.
- View documentation for the original command:
tldr musescore
See also: musescore
$ tldr musescore
musescore
MuseScore 3 sheet music editor.
More information: https://musescore.org/en/handbook/3/command-line-options.
- Use a specific audio driver:
musescore --audio-driver jack|alsa|portaudio|pulse
- Set the MP3 output bitrate in kbit/s:
musescore --bitrate bitrate
- Start MuseScore in debug mode:
musescore --debug
- Enable experimental features, such as layers:
musescore --experimental
- Export the given file to the specified output file. The file type depends on the given extension:
musescore --export-to output_file input_file
- Print a diff between the given scores:
musescore --diff path/to/file1 path/to/file2
- Specify a MIDI import operations file:
musescore --midi-operations path/to/file
$ |
Hmm, I'm tempted. On the one hand it would be nice to save users an unnecessary step to reach the information they want; on the other hand, making an automatic jump (as a symlink would do) can be a little bit too magical, and obscure the fact that the user is seeing the content for a page that's not exactly what they typed. I'm tentatively in favor of this, but I'd call @chrisallenlane from cheat, @srsudar from eg, and @denisidoro from navi for comments, as they might have pondered this as well. Feel free to ping others who may have thoughts on this! |
We first considered literal symlinks but decided against it because git apparently doesn't handle them well on windows. I didn't have a windows machine to try on myself, but you can see a collaborator's comment here. In the end we went with an I don't really have any strong opinions on that approach. It works so smoothly that I'd forgotten we'd added it. It's definitely better than duplicating the commands, I think. It's also an easy thing for users to edit themselves if they have their own aliases. I don't know enough about how A potential benefit is one less click, as it were. Any command that is normally used by an alias might be frustrating for users that prefer one or the other. Eg I thought that Whatever you go with, though, sounds like a great improvement! |
I like the
Of course, client updates prevent us from moving quickly (which isn't always wrong). The benefit of this approach is that, though clients will need to be modified to support this, you're right, they would just ignore
I completely agree with this sentiment. "mildly" at first, perhaps, but more and more it can become quite exasperating, I'd say. I'd warrant it wouldn't be difficult for the clients to intercept the title and change it to the correct, e.g. print the title |
Thanks for the great insights, @srsudar! If I may just add a small note: one of the things in favor of @bl-ue's proposal of alias pages is that they're "low-tech", i.e. even a very dumb "client" that simply |
Yeah that makes sense, it's a very nice middle ground. I didn't realize you supported such diverse clients. One thing I didn't mention but I'm remembering now is that we also display the aliases like so when we This still doesn't help your very simple clients, but might help reduce the magic factor I think (although I have no idea how many actually care about the fact that we display this).
|
Haha yeah @srsudar, we have an absolutely enormous list of clients lol, and they are all developed by different people :P |
Hi, all. |
It looks like we've decided on the alias page mechanism we're going with, and it's already in use (e.g. Does everyone agree we can close this issue now? |
That's OK for me ! |
Ok, I'm going to close this issue for now. However, if anyone has something else to mention, we can always re-open and continue the discussion. |
We need a system for command aliases. For a very few examples:
chdir
command which is internally aliased tocd
com.docker.cli
which is aliased todocker
gcc
has aliasesgcc-10
andx86_64-apple-darwin20-gcc-10
Our current solution to this issue is to duplicate the pages, updating the page title and the command itself in the examples. We haven't officially decided to do this; it's just what happens.
It's not a very good solution though because then we have to maintain two copies of the page, which means more work for translators, normal contributors, and maintainers alike.
I've thought of a few solutions so far:
❌ I've thought before of an idea where all pages have YAML front matter at the top which defines some metadata about the page. It would be applied to every page, because there are opportunities where we might want to store metadata like that. We could store a key
alias: true
andsource: source_cmd
(ororiginal: original_cmd
). The then clients would check for that and read the source page and print it out, updating the page title and the command used in the examples. Unfortunately however, this requires a major change to the client spec. So we've discarded this idea.🥇 My latest idea is that instead of duplicating the source page and updating the title and command names, we create a new page with contents such as these:
with the link intentionally omitted.
The pros with this idea is that it's still simple and valid markdown, and requires no changes to the clients in order to be applied.
Note: per #5300
speedtest
is not an alias forspeedtest-cli
, it's actually the official CLI as opposed to a non-official (but very popular, 10.5k ⭐s) alternative. But I'll just keep the example above to get the point across.The text was updated successfully, but these errors were encountered: