Skip to content
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

Cosmetic: ugly program name in auto-generated help message #108

Closed
vadz opened this issue Nov 19, 2016 · 4 comments
Closed

Cosmetic: ugly program name in auto-generated help message #108

vadz opened this issue Nov 19, 2016 · 4 comments

Comments

@vadz
Copy link

vadz commented Nov 19, 2016

Running zef without arguments or zef --help produces a perfectly nice help message, however making a mistake on zef command line results in another (auto-generated by Perl6, I think?) error message which is not as good but would still be useful if it didn't use a very ugly name with a hash in it instead of just zef, i.e.:

Usage:
  /home/zeitlin/.perl6/resources/3DD33EF601FD300095284AE7C24B770BAADAF32E [--force] fetch [<identities> ...] -- Download specific distributions
  /home/zeitlin/.perl6/resources/3DD33EF601FD300095284AE7C24B770BAADAF32E [--force] test [<paths> ...] -- Run tests
  /home/zeitlin/.perl6/resources/3DD33EF601FD300095284AE7C24B770BAADAF32E [--force] build [<paths> ...] -- Run Build.pm
...

This issue is about resources/3DD33..., it would be really better to have bin/zef instead of it here.

@ugexe
Copy link
Owner

ugexe commented Nov 19, 2016

This is an issue with Rakudo itself and will affect all perl6 scripts that are installed and precompiled. The only way to fix this outside of Rakudo would be to implement an entire GetOpts library in the zef distribution.

@ugexe
Copy link
Owner

ugexe commented Nov 19, 2016

FWIW this occurs because Rakudo installs a wrapper to invoke the actual script that gets installed, so an installed bin/zef not actually the original script and simply invokes the script (which is saved in the hash file shown).

So why can't Rakudo just show 'zef'? This is due to the possibility of shadowed commands, I.e. you may have two directories in PATH that each have a bin/zef. Only the first bin/zef could honestly be represented as 'zef', because otherwise the help command would be lying about how to invoke the script it's a part of. Combined with the "wrapper" scripts (of the same name) that get installed you can see why there is not an easy solution.

zef --help doesn't use Rakudo to auto generate its help message - if it did it would look the same. Unfortunately there is no way to override the current help message that occurs when inputting bad arguments.

@vadz
Copy link
Author

vadz commented Nov 20, 2016

I appreciate the explanations, but FWIW this is overcomplicating things: IMHO Rakudo could still just show zef and nobody would really complain about any ambiguities due to presence of more than just one zef in the PATH, this is not what's really expected from the help message.

Or, to put it otherwise, IMO breaking the common case while trying to address a vanishingly rare scenario is not worth it.

This being said, I'm closing this as it's not really a zef issue in any case. Thanks again for taking time to write the replies!

@vadz vadz closed this as completed Nov 20, 2016
@ugexe
Copy link
Owner

ugexe commented Nov 21, 2016

One of the other options that was discussed was showing the prefix directory stuff once towards the start or end of the help message (possibly only verbose help), and showing only the script name everywhere else in the help. This is nice because when you invoke a script without it being installed (i.e. zef would not work yet) the message still gives enough information to tell if you are running what you really want.

If anyone is inclined to implement this you can find the code here, and the part that handle the file path / invocation name shown is here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants