Mention env in error for bash-style environment overrides #809

Closed
dag opened this Issue May 22, 2013 · 4 comments

Comments

Projects
None yet
4 participants
@dag
Contributor

dag commented May 22, 2013

The question of how to set environment exports for a single command line came up twice today in the IRC channel, and in multiple issues submitted here lately. It's a common gotcha.

Currently if you try the bash syntax, you get a nice error except it's not too relevant:

> EDITOR=vim git commit
fish: Unknown command “EDITOR=vim”. Did you mean “set EDITOR vim”? For
information on assigning values to variables, see the help section on the set
command by typing “help set”.

Perhaps fish could detect if there was any tokens following the environment assignment (ie. a command) and in that case instead print an error message suggesting env EDITOR=vim git commit. If this is hard to get right, perhaps the error above could simply be changed to mention both possibilities.

Cf. #587, #438 etc.

@ridiculousfish

This comment has been minimized.

Show comment
Hide comment
@ridiculousfish

ridiculousfish May 22, 2013

Member

Good idea.

Member

ridiculousfish commented May 22, 2013

Good idea.

@zanchey

This comment has been minimized.

Show comment
Hide comment
@zanchey

zanchey May 23, 2013

Member

I've also added an FAQ as it is genuinely frequently asked!

zanchey/fish-shell@ce12da1

Part of pull request #781

Member

zanchey commented May 23, 2013

I've also added an FAQ as it is genuinely frequently asked!

zanchey/fish-shell@ce12da1

Part of pull request #781

@jdevera

This comment has been minimized.

Show comment
Hide comment
@jdevera

jdevera May 24, 2013

Neither of the proposed solutions work when the command being called is a function. I'll log it.

jdevera commented May 24, 2013

Neither of the proposed solutions work when the command being called is a function. I'll log it.

@ridiculousfish

This comment has been minimized.

Show comment
Hide comment
@ridiculousfish

ridiculousfish Sep 30, 2013

Member

2f33e59 improves the error message for this scenario. Thanks for the idea zanchey!

Member

ridiculousfish commented Sep 30, 2013

2f33e59 improves the error message for this scenario. Thanks for the idea zanchey!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment