-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Custom command attributes #14906
base: main
Are you sure you want to change the base?
Custom command attributes #14906
Conversation
combined with `alias`, makes it possible to have custom attributes useful until `const def` happens
@fdncred I observed the extra line in built-in commands' help texts too. Seems like it was a deliberate choice: nushell/crates/nu-engine/src/documentation.rs Line 330 in 299453e
|
But doesn't need built-ins
ok, I don't like it. 😆 Maybe I'll put to get a PR to remove it. |
Description
Add custom command attributes.
@
character.attr env
is invoked as an attribute as@env
attr example
: Attaches an example to the commands help textattr env
: Equivalent to usingdef --env
attr wrapped
: Equivalent to usingdef --wrapped
scope commands
.@test
which can be used by test runners.echo
const. Purpose of this is to allow custom attribute definitions usingalias
. As there is currently no way to define const commands, this is intended to provide a stopgap solution.scope commands | where attributes.name has "test"
will return all commands that have thetest
attribute.@example
attribute forstd
examples.User-Facing Changes
Users can add examples to their own command definitions, and add other arbitrary attributes.
Tests + Formatting
After Submitting
Add documentation about the attribute syntax and built-in attributes