CSharpRepl
CSharpRepl copied to clipboard
Simplify tool name?
Feature Description
Since it came out, I have loved Visual Studio's CSharp Interactive tool and since I discovered that I could run it outside of it I always had csi.exe
in the system environment variables
I confess that csharprepl
has won it by a lot, because it has managed to have the intellisense that it lacked outside of Visual Studio. Thanks @waf !!
This is not a feature or a bug report per se, it is more of a discussion.
I am not an English speaker and I confess that I almost always forget how to write csharprepl
. I compare it with how I ran CSharp Interactive: Win+R -> csi -> ENTER
. With only 6 keystrokes I achieved what I wanted, csharprepl
by itself is more than 6 keystrokes, which I almost always misspell, so I end up using csi
😫.
Is it possible, at this initial stage of the tool, to change or shorten its name? put a default alias? I've been looking around and I think the dotnet tools don't allow aliases so I'm not very hopeful 😥
Maybe it's just me, so feel free to ignore and close this issue without any problem. Meanwhile if someone is in the same situation as me, I share my solution:
Using cmd
:
- Create a
csi.cmd
file in a folder which path is in thePATH
environment variable - Write
start cmd /K csharprepl
and save - To start
csharprepl
just:Win+R -> csi -> ENTER
Using Windows Terminal
- Create a
csi.cmd
file in a folder which path is in thePATH
environment variable - Write
wt -w 0 nt csharprepl
and save - To start
csharprepl
just:Win+R -> csi -> ENTER
Thanks for raising this, and for the kind words! Yeah, naming things is hard. I tried to avoid naming conflicts with the many other REPL projects out there, and also wanted something google-able, and ended up with this name. I'm open to providing shorter aliases.
Looks like dotnet tools don't support aliases, and have no plans to. We could set up an alias for the user on the first start of csharprepl, either using the .cmd
file above, or the shortcut files below. Platforms like Mac OS and Linux have better alias systems, so probably wouldn't need any special support.
Here are some other ways of opening csharprepl quickly:
- If you already have Windows Terminal open (I almost always do):
- Set up a Windows Terminal profile for C#, as mentioned here: https://github.com/waf/CSharpRepl#windows-terminal, then it can be accessed a bunch of different ways (jump lists, key combos, point and click).
- The prefix of csharprepl should be pretty unique, so on most systems,
csh<tab>
in an existing terminal window should autocomplete tocsharprepl
- If you don't have Windows Terminal open:
- Add csharprepl to the start menu (very similar to your
.cmd
file suggestions), so Win -> cs -> Enter starts it.$shell = New-Object -ComObject WScript.Shell $shortcut = $shell.CreateShortcut("$env:appdata\Microsoft\Windows\Start Menu\Programs\csharprepl.lnk") $shortcut.TargetPath = "wt.exe" $shortcut.Arguments = "-w 0 nt csharprepl.exe" $shortcut.Save()
- Add csharprepl to the start menu (very similar to your
If anyone has suggestions or thoughts on this, happy to discuss more.
@waf This was a good tip.
There does not appear to be any sort of install/uninstall script support for global tools (see https://github.com/dotnet/sdk/issues/10304), which makes supporting this a bit tricky.
It's simple enough to create this alias or start menu entry on first run, but there's no way to remove it on uninstall, which would result in broken commands after the user uninstalls csharprepl.
One could argue that it's easy enough for the user to manually remove the alias, but it's still not a great experience.
Perhaps this alias creation could be opt-in, e.g. csharprepl --create-alias
or similar.
Until there's something more actionable here (e.g. figuring out a way to [un]install scripts or aliases), I've added the above information in the README to help others, in commit 75728d9. Thanks @jjavierdguezas for the tip!
You may also easily create an alias in PowerShell if that tickles your fancy 😄
C:\Users\Fots> New-Alias -Name csr -Value csharprepl
C:\Users\Fots> csr
Welcome to the C# REPL (Read Eval Print Loop)!
Type C# expressions and statements at the prompt and press Enter to evaluate them.
Type help to learn more, and type exit to quit.
>
C:\Users\Fots>
If you're using linux you can add an alias to your .bashrc
. Something like
alias cs=csharprepl
windows:
echo csharprepl %* > c#.bat
put it somewhere in your %path%
win+r
c#
meh...
Closing this, not planning to change the tool name now. The aliases provided in this thread (and also put in the readme) can cover this.