-
Notifications
You must be signed in to change notification settings - Fork 17
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
Adds godot symlink to OS' PATH, auto-detect default SHELL on UNIX systems #54
Conversation
Thanks for taking a look and working on all this. Let me know when this is ready for a closer look. |
This makes the Windows code routine more similar to the UNIX one. - Adds logic to append new path to an existing variable (windows only currently); - Updates documentation about env-var;
Get value from shell, as this will validate if the variable is being overwritten in some place. Making the information more concise with what the user is expecting. - 'AppendToUserEnv' append to the start to give the new value the highest priority.
1069fc1
to
32a4ab7
Compare
a7dc526
to
635c808
Compare
8cd77de
to
a766505
Compare
d2c0db7
to
9c5a5bd
Compare
Let me know if this is ready and I'll take a closer look. (I keep accidentally pressing the "ready for review" button for some reason) |
- Creates 'EnvironmentClient' to wrap System.Environment methods. - Create specific cases for 'OSX' and 'Linux' in PlatformFact.
I think this PR is in good shape for review now! Let me know what you think and if I need to change something. |
Thank you for all your hard work, things are looking great! I left a few comments here and there, nothing major. |
@definitelyokay, I'm not seeing any pending comments or conversation for me to resolve. Maybe I'm doing something wrong? I don't know 😅. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, forgot to actually submit my review 😆
Thank you so much for all your hard work on this. Just the one little comment, it's looking really good! |
I'm making a last round of tests. |
- Better logic to define default shell when the user's one is invalid (MacOS -> zsh, Linux -> bash, Windows -> empty). - More descriptive code comments
Make new cases to validate shell defaulting when user's shell is valid/invalid.
Seems to be working as expected :). |
Hi,
I have been messing around with
godotenv
for some weeks now, and I really liked it. I'm mainly using it to manage my godot installations.My major complaint is that I can't call the new
godot
install through the terminal easily. The installation process gives me theGODOT
env-var, but not exports the symlink in the system PATH nor provides some guidance of how to do it.This PR addresses this and another improvements:
Mainly touches in
godot env setup
andgodot install
commands.Godot binary path now is
../godotenv/godot/bin/godot
instead of../godotenv/godot/bin
;GODOT
env was updated accordingly.Exports godotenv's godot
bin
folder in user'sPATH
on all OSes;Now it's possible to call
godot
by just typing it on the terminal.Env var changes on Windows occur on
USER
environment now, instead ofSYSTEM
;This change tries to make env-var setup more concise across OSes and minimizes the need for an elevated
cmd
shell.SystemEnvironmentVariableClient
class was renamed toEnvironmentVariableClient
. Some methods name has been changed:SetEnv
→SetUserEnv
GetEnv
→GetUserEnv
References in documentation citing "system environment ..." was updated to "user environment ...".
FileClient.AddLinesToFileIfNotPresent()
now writes to the end of the file;This way, new var exports have priority over older ones.
Tries to detect the user's default shell automatic;
People changes the default shell on Linux frequently. So this tries to make a more sensible decision.
To keep things simple and not break godotenv's shell commands, it is assumed that the user's shell is POSIX-compliant (bash, zsh, sh).
Two new functions have been added in
EnvironmentVariableClient.GetDefaultShell()
, andEnvironmentVariableClient.IsShellSupported()
.I think it would be great to call these functions in the program initialization (before running any command) to detect the user's default shell and validate it. But I didn't figure out a good way to do it.
This should resolve the issue [FEATURE] Support for other shells #32.
Tests.
Added some tests for
EnvironmentVariableClient
andGodotRepository
.I did manual testing on Mac M1 13.6.1 (zsh), Ubuntu 22 (zsh and bash) and Windows 11 (PowerShell).
Let me know what you guys think. In case necessary, I can remove or split the changes in another PR.
EnvironmentVariableClient
'sSetUserEnv()
andAppendToUserEnv()
are declared as async function, but their routines are totally synchronous at the moment. So I think we can change their definitions.And, the other way around,
GetUserEnv()
andGetDefaultShell()
are synchronous but could be made asynchronous.Some pictures:
GODOT env:
PATH updated:
Calling from terminal:
User's shell not supported behavior: