cli
cli copied to clipboard
Why Is `--workspace-folder` Required. Can we default to $PWD?
I found it odd that this parameter was required when using devcontainer up and was wondering why and if that was intentional. Not sure if it is also required in other commands ( just learning here ) but did want to share it felt odd to do this.
$ devcontainer up --workspace-folder .
Even more confusing is the devcontainer build [path] which still require --workspace-folder, seems like a bug, either path or workspace-folder but not both please.
Having to type --workspace-folder . all the time is crazy annoying. Please default to $PWD.
Having to type
--workspace-folder .all the time is crazy annoying. Please default to $PWD.
And add support to specify using an ENV variable as well, DEVCONTAINER_WORKSPACE_FOLDER or whatever.
I've created a PR for this.
I've created a PR #425, with a basic check if a .devcontainer directory exists in your cwd. I would be pretty easy to add an ENV variable to it, by adding it to the findWorkspaceFolder Function.
@hpe-ykoehler Currently, I'm not convinced if an ENV variable is needed. Do you have a use case for that?
@MunsMan no, but convention is that config option can be controlled by cli argument, env or config file in that order of priority. Agree env may appears less useful, but devcontainer should use a CLI framework that handles all those details (such as Cobra if written in Go) no?
I'd suggest not to add the environment variable support unless someone asks.
I added this function to my .zshrc, which does not solve the problem, but reduces the pain:
function dev() {
devcontainer $1 --workspace-folder . ${@: 2}
}
Now I can just call dev up or dev exec ls
Maybe it helps someone while the Issue exists.
Hi 👋
Thanks for all the suggestions, and growing interest on this issue. We agree that the cli should have --workspace-folder option as optional and should default to . (ie pwd). We should be able to pick this up soon.