cmd/new: added support for plan-git option

Signed-off-by: Sam Alba <sam.alba@gmail.com>
This commit is contained in:
Sam Alba
2021-04-01 16:45:58 -07:00
parent 530e6dc876
commit fb9aae38ef
2 changed files with 48 additions and 9 deletions

View File

@@ -28,6 +28,7 @@ const (
InputTypeText InputType = "text"
InputTypeJSON InputType = "json"
InputTypeYAML InputType = "yaml"
InputTypeEmpty InputType = ""
)
type Input struct {
@@ -111,7 +112,16 @@ func GitInput(remote, ref, dir string) Input {
}
func (git gitInput) Compile() (*compiler.Value, error) {
panic("NOT IMPLEMENTED")
ref := "HEAD"
if git.Ref != "" {
ref = git.Ref
}
return compiler.Compile("", fmt.Sprintf(
`#compute: [{do:"fetch-git", remote:"%s", ref:"%s"}]`,
git.Remote,
ref,
))
}
// An input artifact loaded from a docker container