-
Notifications
You must be signed in to change notification settings - Fork 396
Add process to add to .bash-profile for dotnet suggest script #357
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
Comments
it is not easy to just write stuff to bashrc since depends on the distro, it could also be bash_profile. And blindly write to it could mess up user's shell config. I am thinking to make a line to let user to copy paste. And that line could be generated by some "guess" like RID and $BASH_VERSION |
Perhaps a command that adds/updates the script in the file at a specified path? > dotnet suggest install --powershell $profile |
(i plan to bikeshed "install" verb later) That's similar. But this command only won't help too much. To find where the profile is the hardest part for existing copy paste solution especially for powershell. At the same time, we cannot guess it 100%. I plan to add export DOTNETSUGGESTSCRIPTVERSION to the script itself. So dotnet-suggest's help could read it and detect if
|
As for update. I think we should check if DOTNETSUGGESTSCRIPTVERSION matches the version dotnet suggest has. And the script will have # DOTNET SUGGEST START and # DOTNET SUGGEST END to mark the beginning and the end. So we know what to delete. Any less hacky idea? |
This could maybe be solved with some additional indirection: The line of script added to the profile could be a one liner that calls out to |
If this is for https://github.com/dotnet/command-line-api/blob/master/src/System.CommandLine.Suggest/dotnet-suggest-shim.bash, the normal system-wide installation style is to install that script with the name of the program in a location like This location probably varies between distros. From what I can tell from some tests, the file name matters: a file named |
This would be a problem for
|
That might work, let me try |
dotnet-suggest has the ability to output the script already... instead of adding the entire script into the profile the instructions should use the following. if hash dotnet-suggest 2>/dev/null ; then source <(dotnet-suggest script bash); fi unfortunately this is not working in bash ❯ if hash dotnet-suggest 2>/dev/null ; then source <(dotnet-suggest script bash); fi
-bash: /dev/fd/63: line 2: syntax error near unexpected token `$'\r''
'bash: /dev/fd/63: line 2: `_dotnet_bash_complete() Completions are such a great idea and really important for users building command line applications that provide a great experience. It is frustrating how buggy it is right now and I end up turning it off. |
The ability to output the script was added to > dotnet suggest install bash /path/to/.bash_profile What other bugs have you seen? They tend to be specific to the environment. If you provide details, they can get fixed. |
prerequisite of #219
The text was updated successfully, but these errors were encountered: