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

Add different color for correct/incorrect command #3439

Open
dancojocaru2000 opened this issue Sep 19, 2022 · 2 comments
Open

Add different color for correct/incorrect command #3439

dancojocaru2000 opened this issue Sep 19, 2022 · 2 comments
Labels
Issue-Enhancement It's a feature request.

Comments

@dancojocaru2000
Copy link

dancojocaru2000 commented Sep 19, 2022

Description of the new feature/enhancement

Add a different color for highlighting if the first word of a command is correct or incorrect (running the command won't result in "The term 'abcedf' is not recognized...").

For example, assuming an environment where v is not a valid program but vi is, typing a command such as v file.txt will highlight the v in a different color to show that v is not a valid command. When typing vi file.txt, vi will have a different color to show that it is a valid command.

Here is an example from fish shell:

Screenshot from 2022-09-19 03-42-16

@dancojocaru2000 dancojocaru2000 added the Issue-Enhancement It's a feature request. label Sep 19, 2022
@ghost ghost added the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label Sep 19, 2022
@dkaszews
Copy link
Contributor

dkaszews commented Oct 21, 2022

What if the first word is a variable? Should we check if it exists? And what if it's a file instead? I believe typing just a filename will open it in default program, same as if given as an argument to Start-Process (can't test it over SSH).

Also, should this coloring apply only to start of the line, or any command? It could be complicated if validity of it changes mid-line, e.g. $env:PATH += $path_to_v; v or Set-Alias 'v' 'vim'; v.

@TransientError
Copy link

TransientError commented Oct 21, 2022

Fish has a different coloring for variables, which is activated as soon as you type '$'. It seems to not change colors with files unless prefaced with './' and the file is executable. And it's only at the first word.

After using it for a long time, I've found it very useful for catching mistakes before executing. I'd love to see this in PowerShell as well.

@StevenBucher98 StevenBucher98 removed the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label Mar 6, 2023
@StevenBucher98 StevenBucher98 added this to the 2.3.0-Consider milestone Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Enhancement It's a feature request.
Projects
None yet
Development

No branches or pull requests

4 participants