Skip to content

Disable alias recursion - #8397

Merged
sophiajt merged 2 commits into
nushell:mainfrom
kubouch:alias-itself
Mar 12, 2023
Merged

sophiajt merged 2 commits into
nushell:mainfrom
kubouch:alias-itself

Conversation

@kubouch

@kubouch kubouch commented Mar 10, 2023 •

Copy link
Copy Markdown
Contributor

Description

Prevents alias from aliasing itself. It allows a commonly requested pattern similar to alias ls = ls -l.

One small issue is that the syntax highlighting is a bit off:
alias_itself_no_color

Fixes #8246

User-Facing Changes

Shouldn't be a breaking change.

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 -- --check to check standard code formatting (cargo fmt --all applies these changes)
  • cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect to check that you're using the standard code style
  • cargo test --workspace to check that all tests pass

After 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.

@kubouch
kubouch marked this pull request as draft March 10, 2023 22:44
@codecov

codecov Bot commented Mar 10, 2023 •

Copy link
Copy Markdown

Codecov Report

Merging #8397 (e9b38e3) into main (af1ab39) will decrease coverage by 0.13%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #8397      +/-   ##
==========================================
- Coverage   68.25%   68.12%   -0.13%     
==========================================
  Files         620      620              
  Lines       99352    99723     +371     
==========================================
+ Hits        67810    67936     +126     
- Misses      31542    31787     +245     
Impacted Files Coverage Δ
crates/nu-parser/src/parse_keywords.rs 68.55% <100.00%> (+0.13%) ⬆️

... and 46 files with indirect coverage changes

@kubouch
kubouch marked this pull request as ready for review March 12, 2023 12:29
@fdncred

fdncred commented Mar 12, 2023 •

Copy link
Copy Markdown
Contributor

Nothing this point here - We need a way to unalias or alias restore <cmd>. People will want to do that, especially if they make a mistake when creating an alias. Work-around is to quit nushell and start it up again.

This "undo" functionality can wait for another PR, imo.

@sophiajt
sophiajt merged commit 808e523 into nushell:main Mar 12, 2023
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

Successfully merging this pull request may close these issues.

cannot alias to the same command anymore

3 participants