-
Notifications
You must be signed in to change notification settings - Fork 248
[RFC][direnv-inspired] introduce export and hook commands, use in devbox shell, global and direnv #1172
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
Conversation
Current dependencies on/for this PR:
This comment was auto-generated by Graphite. |
8975339
to
e24ad15
Compare
95ab2db
to
a9c13a8
Compare
e24ad15
to
61a3bfd
Compare
602db68
to
5f9367c
Compare
5f9367c
to
e23f447
Compare
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.
LGTM
func hookCmd() *cobra.Command { | ||
flags := hookFlags{} | ||
cmd := &cobra.Command{ | ||
Use: "hook [shell]", |
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.
Another possible name for this command is activate
(it's what https://github.com/jdxcode/rtx uses)
Leave as hook, and let's get the PR in, but I wanna get John's thoughts on which one is the better name, before we remove the feature flag and start transitioning people.
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.
yes, agree on activate
. Please see my RFC proposal in the PR summary for reasons why I like it...
61a3bfd
to
751628e
Compare
e23f447
to
f4dc79b
Compare
f4dc79b
to
cc2aff7
Compare
## Summary Minor followup to #1172 ## How was it tested?
…e in devbox shell, global and direnv (#1172)" (#1233) ## Summary Reverts #1172. While we feel architecturally this is a better approach, it would introduce some non-trivial risk. For the moment, bin-wrappers seem to have stabilized so we'll punt on this, and circle back to it later. ## How was it tested? compiles - [ ] testscripts should pass
Summary
See #1156 for overall motivation.
In this PR:
devbox shellenv
.devbox hook
anddevbox export
, analogous todirenv hook
anddirenv export
.export
is an alias of shellenv, and is hiddenhook
registers a shell prompt hook that wil calleval $(devbox export)
devbox shell
, we addeval $(devbox hook)
to the generated shellrc file.direnv
, the code is essentially unchanged except callingdevbox export
instead ofdevbox shellenv
.eval $(devbox global hook <shell>)
RFC proposal to roll out:
devbox export
. We can continue withdevbox shellenv
.devbox hook
entirely: in the generated shellrc, we can inline the code of the hook that callsdevbox export
.devbox global activate
to have the functionality thatdevbox global hook
has in this PR.activate
is a generic word, enabling us to change its functionality under-the-hood. It would save us the dilemma we have with this PR about how to make users change their shellrc code fromdevbox global shellenv
todevbox global hook
.devbox global shellenv
an alias ofdevbox global activate
. This would save users from needing to update their personal shellrc files.How was it tested?
Added a feature flag:
DEVBOX_FEATURE_PROMPT_HOOK=1
.Did some basic testing:
devbox shell
and then editeddevbox.json
to add a new package, and saw the new package being installed prior to next prompt being displayed.devbox run -- iex -S mix
worked as expected, since we can turn off the bin-wrappers.devbox global hook | source
to my fish shell.devbox global ls
worked.devbox global add <package>
worked as before.Note: this PR adds the basic functionality, but the feature is not yet robust. For a full list of pending scenarios that must work, please refer to the (internal) notion doc.