@@ -51,6 +51,7 @@ import (
5151 compose2 "github.com/docker/compose-cli/cmd/compose"
5252 "github.com/docker/compose-cli/local"
5353 "github.com/docker/compose-cli/pkg/api"
54+ "github.com/docker/compose-cli/pkg/compose"
5455
5556 // Backend registrations
5657 _ "github.com/docker/compose-cli/aci"
@@ -237,7 +238,7 @@ func main() {
237238 if err = root .ExecuteContext (ctx ); err != nil {
238239 handleError (ctx , err , ctype , currentContext , cc , root )
239240 }
240- metrics .Track (ctype , os .Args [1 :], metrics .SuccessStatus )
241+ metrics .Track (ctype , os .Args [1 :], compose .SuccessStatus )
241242}
242243
243244func customizeCliForACI (command * cobra.Command , proxy * api.ServiceProxy ) {
@@ -271,7 +272,7 @@ func getBackend(ctype string, configDir string, opts cliopts.GlobalOpts) (backen
271272func handleError (ctx context.Context , err error , ctype string , currentContext string , cc * store.DockerContext , root * cobra.Command ) {
272273 // if user canceled request, simply exit without any error message
273274 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 )
275276 os .Exit (130 )
276277 }
277278 if ctype == store .AwsContextType {
@@ -293,20 +294,20 @@ $ docker context create %s <name>`, cc.Type(), store.EcsContextType), ctype)
293294
294295func exit (ctx string , err error , ctype string ) {
295296 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 )
297298 os .Exit (exit .StatusCode )
298299 }
299300
300- var composeErr metrics. ComposeError
301- metricsStatus := metrics .FailureStatus
301+ var composeErr compose. Error
302+ metricsStatus := compose .FailureStatus
302303 exitCode := 1
303304 if errors .As (err , & composeErr ) {
304305 metricsStatus = composeErr .GetMetricsFailureCategory ().MetricsStatus
305306 exitCode = composeErr .GetMetricsFailureCategory ().ExitCode
306307 }
307308 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
310311 }
311312 metrics .Track (ctype , os .Args [1 :], metricsStatus )
312313
@@ -343,7 +344,7 @@ func checkIfUnknownCommandExistInDefaultContext(err error, currentContext string
343344
344345 if mobycli .IsDefaultContextCommand (dockerCommand ) {
345346 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 )
347348 os .Exit (1 )
348349 }
349350 }
0 commit comments