-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Enhancements to crystal env
#11694
Comments
I support the idea to expose more information, but I don't think |
We could rename |
I don't disagree on making this information easily accessible and machine readable. But I think we should keep a difference between showing compiler build information and runtime configuration. I would be fine with making the proposed variables accessible via |
When I know And to be honest, going from 5 to 13 lines doesn't seem like noise to me. If a script does We could still add functionality such as |
To me, the critical distinction is that the values we're talking are not variables. They're fixed constants of the compiler binary. That's different from I understand the argument about the similar names suggesting handling them together. But it's based on the premise of actually using the proposed scheme of similar names. I'm not committed to that. Compiler build information are not environment variables, so there's no reason to name them like those. |
These properties are the variables of a previous build. Besides, the real-world semantics of "variable" are irrelevant here; as long as As a comparison, consider I think this is the user experience |
I agree with @HertzDevil here: having just a single command sounds better. You usually want to look at some value, and having to remember which command to run to find it isn't ideal. Maybe the issue is that the command is named |
I can't follow the example with Taking $ git --version --build-options
git version 2.34.1
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh That fits exactly with my argument for separation. |
(For that matter, our |
straight-shoota wrote:
I am not involved in the main discussion as such, although I But what I did want to point out is ruby's "gem env" output. It is best to copy/paste it first here when I run it as the
While I can understand straight-shoota's position, I would See python's pip/virtualenv for a related consideration I believe the user's consideration, what the user needs Perhaps if you'd want to you could add some additional |
One other argument for the single command is in diagnostics. If something goes wrong, we can just ask the user to run Thinking about @asterite's comment that maybe the |
I think we should expose the rest of the special constants under the
Crystal
module plus some others forcrystal env
(exceptCrystal::DESCRIPTION
, because it can be computed from other strings), for use in external scripts:CRYSTAL_BUILD_COMMIT
: corresponds toCrystal::BUILD_COMMIT
.CRYSTAL_BUILD_DATE
: corresponds toCrystal::BUILD_DATE
.CRYSTAL_HOST_TARGET
: corresponds toCrystal::Config.host_target
, i.e. the default target shown undercrystal --version
.CRYSTAL_DEFAULT_PATH
: corresponds toCrystal::DEFAULT_PATH
.CRYSTAL_LIBRARY_PATH
: corresponds toCrystal::LIBRARY_PATH
.CRYSTAL_DEFAULT_LIBRARY_PATH
: corresponds toCrystal::Config.library_path
, i.e. the value ofCRYSTAL_CONFIG_LIBRARY_PATH
this compiler was built with.Additionally the command should be able to tell whether optional components of the compiler are available:
CRYSTAL_HAS_INTERPRETER
: is0
if the compiler was built with-Dwithout_interpreter
, is1
otherwise. Is implicitly empty for Crystal 1.2 or below.CRYSTAL_HAS_PLAYGROUND
: like above, but checks for-Dwithout_playground
.Currently the only way to tell whether a compiler binary has interpreter support is to do
crystal interactive ??? 2>/dev/null
and then inspect the exit code, and for playground support it is even more tedious. Those extra variables would save the hassle.The text was updated successfully, but these errors were encountered: