mirror of
https://github.com/docker/compose.git
synced 2026-08-27 03:45:29 +00:00
--no-interpolate
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
3c287fa5c2
commit
15b56b3e8d
4 changed files with 39 additions and 32 deletions
|
|
@ -65,8 +65,8 @@ func (o *projectOptions) toProjectName() (string, error) {
|
|||
return project.Name, nil
|
||||
}
|
||||
|
||||
func (o *projectOptions) toProject(services []string) (*types.Project, error) {
|
||||
options, err := o.toProjectOptions()
|
||||
func (o *projectOptions) toProject(services []string, po ...cli.ProjectOptionsFn) (*types.Project, error) {
|
||||
options, err := o.toProjectOptions(po...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -90,13 +90,14 @@ func (o *projectOptions) toProject(services []string) (*types.Project, error) {
|
|||
return project, err
|
||||
}
|
||||
|
||||
func (o *projectOptions) toProjectOptions() (*cli.ProjectOptions, error) {
|
||||
func (o *projectOptions) toProjectOptions(po ...cli.ProjectOptionsFn) (*cli.ProjectOptions, error) {
|
||||
return cli.NewProjectOptions(o.ConfigPaths,
|
||||
cli.WithEnvFile(o.EnvFile),
|
||||
cli.WithDotEnv,
|
||||
cli.WithOsEnv,
|
||||
cli.WithWorkingDirectory(o.ProjectDir),
|
||||
cli.WithName(o.ProjectName))
|
||||
append(po,
|
||||
cli.WithEnvFile(o.EnvFile),
|
||||
cli.WithDotEnv,
|
||||
cli.WithOsEnv,
|
||||
cli.WithWorkingDirectory(o.ProjectDir),
|
||||
cli.WithName(o.ProjectName))...)
|
||||
}
|
||||
|
||||
// Command returns the compose command with its child commands
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/cnabio/cnab-to-oci/remotes"
|
||||
"github.com/compose-spec/compose-go/cli"
|
||||
"github.com/distribution/distribution/v3/reference"
|
||||
cliconfig "github.com/docker/cli/cli/config"
|
||||
"github.com/opencontainers/go-digest"
|
||||
|
|
@ -38,13 +39,14 @@ import (
|
|||
|
||||
type convertOptions struct {
|
||||
*projectOptions
|
||||
Format string
|
||||
Output string
|
||||
quiet bool
|
||||
resolve bool
|
||||
services bool
|
||||
volumes bool
|
||||
hash string
|
||||
Format string
|
||||
Output string
|
||||
quiet bool
|
||||
resolve bool
|
||||
noInterpolate bool
|
||||
services bool
|
||||
volumes bool
|
||||
hash string
|
||||
}
|
||||
|
||||
var addFlagsFuncs []func(cmd *cobra.Command, opts *convertOptions)
|
||||
|
|
@ -82,6 +84,7 @@ func convertCommand(p *projectOptions) *cobra.Command {
|
|||
flags.StringVar(&opts.Format, "format", "yaml", "Format the output. Values: [yaml | json]")
|
||||
flags.BoolVar(&opts.resolve, "resolve-image-digests", false, "Pin image tags to digests.")
|
||||
flags.BoolVarP(&opts.quiet, "quiet", "q", false, "Only validate the configuration, don't print anything.")
|
||||
flags.BoolVar(&opts.noInterpolate, "no-interpolate", false, "Don't interpolate environment variables.")
|
||||
|
||||
flags.BoolVar(&opts.services, "services", false, "Print the service names, one per line.")
|
||||
flags.BoolVar(&opts.volumes, "volumes", false, "Print the volume names, one per line.")
|
||||
|
|
@ -101,7 +104,7 @@ func runConvert(ctx context.Context, opts convertOptions, services []string) err
|
|||
return err
|
||||
}
|
||||
|
||||
project, err := opts.toProject(services)
|
||||
project, err := opts.toProject(services, cli.WithInterpolation(!opts.noInterpolate))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue