Skip to content

alias with if condition crashes nushell #7512

@fdncred

Description

@fdncred

Describe the bug

Working through #7505 I came up with this, which works until you assign it to an alias. Then you type the i in vi it crashes with.
Screenshot 2022-12-17 at 7 25 37 AM

alias

alias vi = if not ((which nvim) | is-empty) { nvim } else if not ((which vim) | is-empty) { vim }

I also tried this with the same result

alias vi = (if not ((which nvim) | is-empty) { nvim } else if not ((which vim) | is-empty) { vim })

In general, there are multiple issues around alias. It would be nice to fix them. Also, this if functionality is also very command. People want to define things based on if. We should make that more intuitive.

How to reproduce

see above

Expected behavior

execute alias without crash

Screenshots

No response

Configuration

key value
version 0.72.2
branch main
commit_hash 017a13f
build_os macos-aarch64
build_target aarch64-apple-darwin
rust_version rustc 1.65.0 (897e37553 2022-11-02)
rust_channel 1.65.0-aarch64-apple-darwin
cargo_version cargo 1.65.0 (4bc8f24d3 2022-10-20)
pkg_version 0.72.2
build_time 2022-12-05 17:02:09 -06:00
build_rust_channel release
features database, dataframe, default, trash, which, zip
installed_plugins custom-value generate, custom-value generate2, custom-value update, from parquet, gstat, inc, nu-example-1, nu-example-2, nu-example-3, pnet, query, query json, query web, query xml, regex

Additional context

No response

Metadata

Metadata

Assignees

Labels

category:bugSomething isn't workingdeprecated:priority(deprecated: used infrequently) these issues are important

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions