Repository navigation
tighter restrictions on alias and def names - #7392
Conversation
|
high-pitched nasally voice "Hashtag" isn't really the correct name for that ASCII symbol… it's just a "hash"… a "hashtag" is a hash + a tag of text… |
| )); | ||
| assert!(actual | ||
| .err | ||
| .contains("alias name can't be a number, a filesize, or contain a hash")); |
There was a problem hiding this comment.
we could probably say something like "alias name can't start with a number or contain a hash"
Then prevent anything that starts with a number, in case we add support for more number+unit in the future.
There was a problem hiding this comment.
The issue I found with that was the command 7z, which is still widely used. If we just disallow anything that starts with a number, custom completions can't be written for that, so I feel just updating when support is added for more number+unit is still better for the end-user.
|
What is the status on this PR? Do we need to take into account more exceptions like with |
|
I think this is probably good to go, I agree that we should let aliases start with a number because Personally I would put the |
|
it's a good time to land this if we still think it's good to go. |
Description
Prevent a situation where a
defcan't be run due to a poor choice of name. Related: #6335. Hashtags, numbers and filesizes are no longer allowed.aliascheck has been moved because previouslyalias 123would be caught butalias "123"would be permitted.User-Facing Changes
Some definitions can no longer be made, but because they couldn't be run previously anyway, it doesn't really matter.
Tests + Formatting
Don't forget to add tests that cover your changes.
Make sure you've run and fixed any issues with these commands:
cargo fmt --all -- --checkto check standard code formatting (cargo fmt --allapplies these changes)cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A clippy::needless_collectto check that you're using the standard code stylecargo test --workspaceto check that all tests passAfter Submitting
If your PR had any user-facing changes, update the documentation after the PR is merged, if necessary. This will help us keep the docs up to date.