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

Improve setting temporary variable for interative use #1776

Open
1 task done
xofyarg opened this issue Mar 27, 2024 · 2 comments
Open
1 task done

Improve setting temporary variable for interative use #1776

xofyarg opened this issue Mar 27, 2024 · 2 comments

Comments

@xofyarg
Copy link
Contributor

xofyarg commented Mar 27, 2024

What new feature should Elvish have?

In the follow use case, when running an adhoc command with a certain variable, we got a deprecation warning.

~> E:LS_COLORS= ls
Deprecation: the legacy temporary assignment syntax is deprecated; use "tmp" instead
  [tty 2]:1:1-12: E:LS_COLORS= ls

The current builtin way of doing it is like below, with some extra key presses. Rely on external env is another method.

{ tmp E:LS_COLORS = ''; ls }

It's probably more convenient, if we could improve this a little bit, e.g. wrap user input with a closure automatically.

Output of "elvish -version"

0.21.0-dev.unknown

Code of Conduct

@krader1961
Copy link
Contributor

krader1961 commented Apr 24, 2024

Why ins't the env command (e.g., env LS_COLORS='' ls) a reasonable solution to this problem? The cost is close to zero and adds just a couple of characters when type interactively compared to the deprecated E:LS_COLORS='' ls syntax. If you're on Windows an Elvish env function is reasonably straightforward to implement. Your "wrap user input with a closure automatically" comment suggests you are looking for a solution that is only applicable to interactive user input. I would argue that is an anti-pattern. That is, I think any solution to this problem should work for interactive REPL and non-interactive Elvish command blocks. Special casing interactive REPL usage seems likely to be hard to document, hard to justify, and likely to confuse users.

@xiaq
Copy link
Member

xiaq commented Apr 25, 2024

I will engage in the technical points later, but here are some comments as a moderator to @krader1961's comment above.


Why ins't the env command (e.g., env LS_COLORS='' ls) a reasonable solution to this problem? The cost is close to zero and adds just a couple of characters when type interactively compared to the deprecated E:LS_COLORS='' ls syntax. If you're on Windows an Elvish env function is reasonably straightforward to implement.

Please don't be dismissive of other people's preference gratuitously.

Your "wrap user input with a closure automatically" comment suggests you are looking for a solution that is only applicable to interactive user input. I would argue that is an anti-pattern. That is, I think any solution to this problem should work for interactive REPL and non-interactive Elvish command blocks. Special casing interactive REPL usage seems likely to be hard to document, hard to justify, and likely to confuse users.

Please don't use straw-man arguments.

Here is a reminder for the code of conduct for Elvish's community spaces, including the issue tracker.

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

No branches or pull requests

3 participants