@@ -51,6 +51,7 @@ import (
51
51
compose2 "github.com/docker/compose-cli/cmd/compose"
52
52
"github.com/docker/compose-cli/local"
53
53
"github.com/docker/compose-cli/pkg/api"
54
+ "github.com/docker/compose-cli/pkg/compose"
54
55
55
56
// Backend registrations
56
57
_ "github.com/docker/compose-cli/aci"
@@ -237,7 +238,7 @@ func main() {
237
238
if err = root .ExecuteContext (ctx ); err != nil {
238
239
handleError (ctx , err , ctype , currentContext , cc , root )
239
240
}
240
- metrics .Track (ctype , os .Args [1 :], metrics .SuccessStatus )
241
+ metrics .Track (ctype , os .Args [1 :], compose .SuccessStatus )
241
242
}
242
243
243
244
func customizeCliForACI (command * cobra.Command , proxy * api.ServiceProxy ) {
@@ -271,7 +272,7 @@ func getBackend(ctype string, configDir string, opts cliopts.GlobalOpts) (backen
271
272
func handleError (ctx context.Context , err error , ctype string , currentContext string , cc * store.DockerContext , root * cobra.Command ) {
272
273
// if user canceled request, simply exit without any error message
273
274
if api .IsErrCanceled (err ) || errors .Is (ctx .Err (), context .Canceled ) {
274
- metrics .Track (ctype , os .Args [1 :], metrics .CanceledStatus )
275
+ metrics .Track (ctype , os .Args [1 :], compose .CanceledStatus )
275
276
os .Exit (130 )
276
277
}
277
278
if ctype == store .AwsContextType {
@@ -293,20 +294,20 @@ $ docker context create %s <name>`, cc.Type(), store.EcsContextType), ctype)
293
294
294
295
func exit (ctx string , err error , ctype string ) {
295
296
if exit , ok := err .(cli.StatusError ); ok {
296
- metrics .Track (ctype , os .Args [1 :], metrics .SuccessStatus )
297
+ metrics .Track (ctype , os .Args [1 :], compose .SuccessStatus )
297
298
os .Exit (exit .StatusCode )
298
299
}
299
300
300
- var composeErr metrics. ComposeError
301
- metricsStatus := metrics .FailureStatus
301
+ var composeErr compose. Error
302
+ metricsStatus := compose .FailureStatus
302
303
exitCode := 1
303
304
if errors .As (err , & composeErr ) {
304
305
metricsStatus = composeErr .GetMetricsFailureCategory ().MetricsStatus
305
306
exitCode = composeErr .GetMetricsFailureCategory ().ExitCode
306
307
}
307
308
if strings .HasPrefix (err .Error (), "unknown shorthand flag:" ) || strings .HasPrefix (err .Error (), "unknown flag:" ) || strings .HasPrefix (err .Error (), "unknown docker command:" ) {
308
- metricsStatus = metrics .CommandSyntaxFailure .MetricsStatus
309
- exitCode = metrics .CommandSyntaxFailure .ExitCode
309
+ metricsStatus = compose .CommandSyntaxFailure .MetricsStatus
310
+ exitCode = compose .CommandSyntaxFailure .ExitCode
310
311
}
311
312
metrics .Track (ctype , os .Args [1 :], metricsStatus )
312
313
@@ -343,7 +344,7 @@ func checkIfUnknownCommandExistInDefaultContext(err error, currentContext string
343
344
344
345
if mobycli .IsDefaultContextCommand (dockerCommand ) {
345
346
fmt .Fprintf (os .Stderr , "Command %q not available in current context (%s), you can use the \" default\" context to run this command\n " , dockerCommand , currentContext )
346
- metrics .Track (contextType , os .Args [1 :], metrics .FailureStatus )
347
+ metrics .Track (contextType , os .Args [1 :], compose .FailureStatus )
347
348
os .Exit (1 )
348
349
}
349
350
}
0 commit comments