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

feat(elvish)!: remove deprecated syntax for Elvish v0.17.0 #1168

Closed
wants to merge 5 commits into from
Closed

feat(elvish)!: remove deprecated syntax for Elvish v0.17.0 #1168

wants to merge 5 commits into from

Conversation

cherryblossom000
Copy link
Contributor

Summary

Some fixes and improvements for the Elvish support.

  • Updates Elvish script to prevent deprecation warnings on Elvish v0.17.0. This is breaking as it won't work for Elvish versions prior to v0.17.0 (released in December 2021).
  • Support calling asdf with no arguments. Previously, this would happen:
    ~> asdf
    Exception: arity mismatch: arguments must be 1 or more values, but is 0 values
    
  • Add set-env ASDF_DIR (brew --prefix asdf)/libexec; set-env ASDF_DATA_DIR ~/.asdf to the rc.elv for Homebrew (the Elvish script sets ASDF_DIR to ~/.asdf by default and ASDF_DATA_DIR to ASDF_DIR, which is incorrect for Homebrew installations)
  • Update docs to reflect changes to the Elvish RC file location in v0.17.0. The new location depends on $XDG_CONFIG_HOME on Unix and %AppData% on Windows, so I linked to the docs and used ~/.config/elvish/rc.elv in the installation script. I haven't updated the Chinese docs properly as I don't know Chinese and instead replaced ~/.elvish/rc.elv with ~/.config/elvish/rc.elv without the link to the Elvish docs.

These are some more subjective and minor changes as well (please let me know I should undo the commit):

Other Information

Sorry if this PR does too many things at once; I just noticed a few things I could improve with the Elvish support when updating it to work for the latest Elvish version. I'm very happy to split up this PR into smaller ones.

@cherryblossom000 cherryblossom000 requested a review from a team as a code owner January 30, 2022 11:40
@cherryblossom000 cherryblossom000 changed the title Elvish support improvements feat!(elvish): remove deprecated syntax for Elvish v0.17.0 Jan 30, 2022
Use new
- assignment syntax (legacy `foo = bar` instead of `var foo = bar` or `set foo = bar` deprecated in v0.15.0)
- slice syntax (legacy `a:b` instead of `a..b` deprecated in v0.15.0)
- lambda syntax (legacy `[args]{ body }` instead of `{|args| body }` deprecated in v0.17.0)

BREAKING CHANGE: Drops support for Elvish versions prior to v0.17.0 due
to the new lambda syntax.
This commit stops this error:

```
~> asdf
Exception: arity mismatch: arguments must be 1 or more values, but is 0 values
```
- Use [tilde expansion][1] instead of `$E:HOME`
- Set `asdf~` variable instead of creating a `fn asdf` and explicitly
  passing arguments (see [docs on the `~` variable suffix][2])
- Use some destructuring in the `asdf` function using a [rest
  variable][3]

[1]: https://elv.sh/ref/language.html#tilde-expansion
[2]: https://elv.sh/ref/language.html#variable-suffix
[3]: https://elv.sh/ref/language.html#var
More details: https://elv.sh/ref/command.html#rc-file

I haven't properly updated the Chinese docs for Getting Started as I
don't know Chinese. For now, I just replaced `~/.elvish/rc.elv` with
`~/.config/elvish/rc.elv`.
@cherryblossom000 cherryblossom000 changed the title feat!(elvish): remove deprecated syntax for Elvish v0.17.0 feat(elvish)!: remove deprecated syntax for Elvish v0.17.0 Jan 30, 2022
@Stratus3D
Copy link
Member

Stratus3D commented Feb 3, 2022

This looks like a duplicate of #1159. Is it not?

@cherryblossom000
Copy link
Contributor Author

Oops, it is. Sorry, I forgot to check if there was a already an existing PR!

@Stratus3D
Copy link
Member

@cherryblossom000 if you want to help review the code changes on #1159 that would be great! I'm not a elvish shell user. I am planning on reviewing that PR tomorrow.

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.

None yet

2 participants