mirror of
https://github.com/docker/compose.git
synced 2026-08-04 14:47:40 +00:00
introduce options struct in the API
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
855a879a6a
commit
eda6a59379
14 changed files with 77 additions and 38 deletions
|
|
@ -20,6 +20,8 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/docker/compose-cli/api/compose"
|
||||
|
||||
"github.com/compose-spec/compose-go/cli"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
|
|
@ -61,7 +63,9 @@ func runConvert(ctx context.Context, opts composeOptions) error {
|
|||
return err
|
||||
}
|
||||
|
||||
json, err = c.ComposeService().Convert(ctx, project, opts.Format)
|
||||
json, err = c.ComposeService().Convert(ctx, project, compose.ConvertOptions{
|
||||
Format: opts.Format,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ package compose
|
|||
import (
|
||||
"context"
|
||||
|
||||
"github.com/docker/compose-cli/api/compose"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/docker/compose-cli/api/client"
|
||||
|
|
@ -52,7 +54,9 @@ func runDown(ctx context.Context, opts composeOptions) error {
|
|||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return projectName, c.ComposeService().Down(ctx, projectName, false)
|
||||
return projectName, c.ComposeService().Down(ctx, projectName, compose.DownOptions{
|
||||
RemoveOrphans: false,
|
||||
})
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,9 @@ func runUp(ctx context.Context, opts composeOptions, services []string) error {
|
|||
}
|
||||
|
||||
_, err = progress.Run(ctx, func(ctx context.Context) (string, error) {
|
||||
return "", c.ComposeService().Up(ctx, project, opts.Detach)
|
||||
return "", c.ComposeService().Up(ctx, project, compose.UpOptions{
|
||||
Detach: opts.Detach,
|
||||
})
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
|
@ -96,7 +98,7 @@ func runCreateStart(ctx context.Context, opts composeOptions, services []string)
|
|||
fmt.Println("Gracefully stopping...")
|
||||
ctx = context.Background()
|
||||
_, err = progress.Run(ctx, func(ctx context.Context) (string, error) {
|
||||
return "", c.ComposeService().Down(ctx, project.Name, false)
|
||||
return "", c.ComposeService().Down(ctx, project.Name, compose.DownOptions{})
|
||||
})
|
||||
}
|
||||
return err
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue