cli: infer a default environment when none is specified#643
Draft
pgavlin wants to merge 1 commit into
Draft
Conversation
These changes allow `esc env open`, `esc env run`, `esc env get`, and friends to operate without an explicit environment argument. The default environment is inferred from a `.esc.yaml` file in the working directory or any parent, falling back to the imports of the currently-selected Pulumi IaC stack. The `.esc.yaml` schema accepts three forms under its `environment` field: a single environment reference, an anonymous list of imports, or a command whose JSON stdout matches either of the prior two forms. See `esc env --help` for the full schema. `esc env open` and `esc env run` accept an inferred import list directly, opening it as an anonymous environment. Commands that operate on a specific named environment error if the inferred default is a list rather than a single reference. `esc env ls` annotates the inferred default with `(default)`.
2a60ed0 to
4c9eef6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These changes allow
esc env open,esc env run,esc env get, and friendsto operate without an explicit environment argument. The default environment
is inferred from a
.esc.yamlfile in the working directory or any parent,falling back to the imports of the currently-selected Pulumi IaC stack.
The
.esc.yamlschema accepts three forms under itsenvironmentfield: asingle environment reference, an anonymous list of imports, or a command
whose JSON stdout matches either of the prior two forms. See
esc env --helpfor the full schema.
esc env openandesc env runaccept an inferred import list directly,opening it as an anonymous environment. Commands that operate on a specific
named environment error if the inferred default is a list rather than a
single reference.
esc env lsannotates the inferred default with(default).