-
Notifications
You must be signed in to change notification settings - Fork 264
[CLI] Added install command #780
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
I think it's not necessary because when users run |
I like the concept, but I find the command name to be confusing. It's not immediately obvious what the difference is between Some random ideas for names:
|
@hezhizhen this is true, but we've had a few users ask for a way to trigger the package install manually for things like CI. You may want to know that your entire environment is downloaded and installed (and maybe cache it) before proceeding with other CI steps. Right now the workaround is to run something like |
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.
My take:
- I agree we need this functionality
- I also agree with Greg that
devbox install
anddevbox add
are too similar.
I think devbox init
should do an "install step" at the end. That way we avoid adding more top-level commands.
internal/boxcli/run.go
Outdated
command := &cobra.Command{ | ||
Use: "install", | ||
Short: "Installs all packages mentioned in devbox.json", | ||
Long: "Starts a new shell and installs all packages mentioned in devbox.json or a json file" + |
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.
I don't think this is accurate:
or a json file specified via --config
I believe we always look for a devbox.json
file at the directory specified by --config
. See these lines where we first get the "projectDir" and then append the hardcoded configFilename
which is devbox.json
:
https://github.com/jetpack-io/devbox/blob/bf52b9a6324f3d4fb65dc92ce1f67240f151cc9d/internal/impl/devbox.go#L88-L92
internal/boxcli/run.go
Outdated
command := &cobra.Command{ | ||
Use: "install", | ||
Short: "Installs all packages mentioned in devbox.json", | ||
Long: "Starts a new shell and installs all packages mentioned in devbox.json or a json file" + |
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.
Should we clarify that the shell is a devbox shell?
i.e. suggestion: "Starts a new devbox shell
and ...."
Args: cobra.MaximumNArgs(0), | ||
PreRunE: ensureNixInstalled, | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
err := runScriptCmd(cmd, []string{":"}, flags) |
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.
for shell n00bs like myself, would you mind adding a small comment explaining that :
is a noop in 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.
Discussing IRL, the compelling argument is that init
, install
and add
sub-commands are a common pattern for similar package managers like yarn
, bundler
, poetry
.
Accepting modulo my suggestions below which I think are fairly straightforward to amend. Thanks!
I think |
@hezhizhen We had people asking for a way to install all their packages separately before going into devbox shell. Mostly, in CICD stages or with Dockerfile where installed packages can be cached as a layer in building stage of a container. With all that said, do you have a nicer idea to implement instead of recommending
This is a separate issue. We have been experimenting with different ideas and implementations of |
You don't need to repeat what's been said before.
My point is, should we have both of
Ignore it now. |
Please ignore my comments, I'm not sure what's better. |
@hezhizhen only having devbox install would imply removing devbox add which is difficult to do since most users would have to re-learn/re-implement devbox install [pkg] instead of devbox add [pkg]. Thanks a ton for providing your input on this. After a ton of discussion internally, we're gonna follow the pattern of well-known CLI tools and have a devbox install command. But it's only gonna be a small alias for |
Summary
Added devbox install command. Re-used the same functions as devbox run since it's just an alias for calling
devbox run -- :
(:
is noop in shell).How was it tested?
./devbox install