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

Cannot access help command when alias set #1290

Closed
archetyped opened this issue May 13, 2023 · 8 comments
Closed

Cannot access help command when alias set #1290

archetyped opened this issue May 13, 2023 · 8 comments

Comments

@archetyped
Copy link

archetyped commented May 13, 2023

Miller's help command is no longer accessible when an alias is set for mlr to automatically load a library of functions (as referenced in the docs):

alias mlr='mlr --load ~/my-functions.mlr'

After that, it looks like Miller is interpreting help as a verb:

$ mlr help topics
mlr: verb "help" not found. Please use "mlr --help" for a list.

Any workarounds to keep the auto-loading alias, but also maintain access to Miller's help command? Already tried setting a separate alias for mlr help (e.g. mlr-help), but the mlr portion in that alias still appears to be expanded to the auto-loading alias, resulting the in the same error message as above. 😿

@johnkerl
Copy link
Owner

Yikes! :|

OK, there should be a way to have help be found when it's not first on the command line. Maybe when it's the first verb-looking thing on the command line, after the command-line-parse step, but before the set-up-data-stream step. I can do that as a software mod.

Nearer-term, as a workaround, shells will generally accept a leading backslash -- e.g. if alias rm='rm -i', then \rm is just the bare command without the -i aliases in. Or /bin/rm. So you can \mlr help or /usr/local/bin/mlr help (or wherever mlr is installed on your system), for the moment.

@johnkerl johnkerl self-assigned this May 13, 2023
@johnkerl johnkerl added the bug label May 13, 2023
@archetyped
Copy link
Author

Awesome, thanks for the tip 👍 \mlr help works!

@archetyped
Copy link
Author

On a somewhat related note, where do flags such as --always-color go when using mlr help (e.g. when piping output to less)? For example, I see the --help-color flag in the docs, which seems like it should be used with mlr help, but I get no joy when trying to use flags in different positions:

$ mlr --always-color help topics
mlr: verb "help" not found. Please use "mlr --help" for a list.

$ mlr help topics --always-color
mlr help topics takes no additional argument.

$ mlr help --always-color topics
--always-color
Instructs Miller to colorize output even when it normally would not. Useful for piping output to `less -r`.
No help found for "topics". Please try 'mlr help find topics' for approximate match.
See also 'mlr help topics'.

Perhaps I'm missing something basic?

@johnkerl
Copy link
Owner

@archetyped try mlr help flags or mlr help find --always-color

There should be an option for mlr help flags --always-color -- current mlr help flags doesn't let you put anything after

@archetyped
Copy link
Author

archetyped commented May 14, 2023

@johnkerl apologies if I wasn't clear. I'm not asking how to access documentation for flags, rather I want to be able to use flags such as --always-color with the help command.

As noted in Miller's documentation for the --always-color flag, flags are useful for piping output to less, but I cannot find a way to set flags when outputting documentation via mlr help. For example, the following results in an error message from Miller being piped into less:

mlr --always-color help flags | less -r

Likewise, according to the docs --help-color flag appears to be meant specifically for use with the help command, but it's not clear how/where to set that flag when using the help command.

$ mlr --help-color seagreen1 help flags
# Output: mlr: verb "help" not found. Please use "mlr --help" for a list.

@johnkerl
Copy link
Owner

Ahhh yes. :)

That needs fixing.

@johnkerl
Copy link
Owner

@archetyped as of #1292:

  • mlr --always-color help flags | less -r produces colorized output
  • mlr --help-color seagreen1 help flags works
  • No need for \mlr help if mlr is aliased to mlr --load ~/my-functions.mlr
  • mlr help flag --always-color exists

@archetyped
Copy link
Author

archetyped commented May 16, 2023

Awesome, thanks! Looking forward to it.

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

No branches or pull requests

2 participants