-
Notifications
You must be signed in to change notification settings - Fork 277
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/cue: implement cue mod init --source
It seems to be really common to invoke `cue mod init` followed by setting the source field, so make that flow more straightforward by adding a `--source` flag to `cue mod init`. Also update the e2e tests to use it. Signed-off-by: Roger Peppe <rogpeppe@gmail.com> Change-Id: I610a851e05b36bf828a21ff6d7bb13daf3cc748b Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1193590 TryBot-Result: CUEcueckoo <cueckoo@cuelang.org> Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com> Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
- Loading branch information
Showing
8 changed files
with
77 additions
and
21 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Test that we can use the --source flag to cue mod init. | ||
|
||
env CUE_VERSION_OVERRIDE=v0.9.0-alpha.2 | ||
|
||
mkdir $WORK/test0 | ||
cd $WORK/test0 | ||
exec cue mod init --source self test.example | ||
cmp cue.mod/module.cue $WORK/want-module.cue-0 | ||
|
||
mkdir $WORK/test1 | ||
cd $WORK/test1 | ||
exec cue mod init --source git test.example | ||
cmp cue.mod/module.cue $WORK/want-module.cue-1 | ||
|
||
mkdir $WORK/test2 | ||
cd $WORK/test2 | ||
! exec cue mod init --source bad test.example | ||
cmp stderr $WORK/want-stderr | ||
|
||
-- want-module.cue-0 -- | ||
module: "test.example" | ||
language: { | ||
version: "v0.9.0-alpha.2" | ||
} | ||
source: { | ||
kind: "self" | ||
} | ||
-- want-module.cue-0 -- | ||
module: "test.example" | ||
language: { | ||
version: "v0.9.0-alpha.2" | ||
} | ||
source: { | ||
kind: "self" | ||
} | ||
-- want-module.cue-1 -- | ||
module: "test.example" | ||
language: { | ||
version: "v0.9.0-alpha.2" | ||
} | ||
source: { | ||
kind: "git" | ||
} | ||
-- want-stderr -- | ||
unrecognized source kind "bad" |
This file contains 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
This file contains 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
This file contains 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
This file contains 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