@@ -377,7 +377,7 @@ var composeCmd = &cobra.Command{
377
377
Use : "compose" ,
378
378
Aliases : []string {"stack" },
379
379
Args : cobra .NoArgs ,
380
- Short : "Work with local docker-compose.yml files" ,
380
+ Short : "Work with local Compose files" ,
381
381
}
382
382
383
383
func printEndpoints (serviceInfos []* defangv1.ServiceInfo ) {
@@ -399,7 +399,7 @@ func printEndpoints(serviceInfos []*defangv1.ServiceInfo) {
399
399
var composeUpCmd = & cobra.Command {
400
400
Use : "up" ,
401
401
Annotations : authNeededAnnotation ,
402
- Args : cobra .NoArgs ,
402
+ Args : cobra .NoArgs , // TODO: takes optional list of service names
403
403
Short : "Like 'start' but immediately tracks the progress of the deployment" ,
404
404
RunE : func (cmd * cobra.Command , args []string ) error {
405
405
var filePath , _ = cmd .InheritedFlags ().GetString ("file" )
@@ -428,8 +428,8 @@ var composeStartCmd = &cobra.Command{
428
428
Use : "start" ,
429
429
Aliases : []string {"deploy" },
430
430
Annotations : authNeededAnnotation ,
431
- Args : cobra .NoArgs ,
432
- Short : "Reads a docker-compose.yml file and deploys services to the cluster" ,
431
+ Args : cobra .NoArgs , // TODO: takes optional list of service names
432
+ Short : "Reads a Compose file and deploys services to the cluster" ,
433
433
RunE : func (cmd * cobra.Command , args []string ) error {
434
434
var filePath , _ = cmd .InheritedFlags ().GetString ("file" )
435
435
var force , _ = cmd .Flags ().GetBool ("force" )
@@ -450,12 +450,28 @@ var composeStartCmd = &cobra.Command{
450
450
},
451
451
}
452
452
453
+ var composeRestartCmd = & cobra.Command {
454
+ Use : "restart" ,
455
+ Annotations : authNeededAnnotation ,
456
+ Args : cobra .NoArgs , // TODO: takes optional list of service names
457
+ Short : "Reads a Compose file and restarts its services" ,
458
+ RunE : func (cmd * cobra.Command , args []string ) error {
459
+ var filePath , _ = cmd .InheritedFlags ().GetString ("file" )
460
+
461
+ _ , err := cli .ComposeRestart (cmd .Context (), client , filePath , string (tenantId ))
462
+ if err != nil {
463
+ return err
464
+ }
465
+ return nil
466
+ },
467
+ }
468
+
453
469
var composeDownCmd = & cobra.Command {
454
470
Use : "down" ,
455
471
Aliases : []string {"stop" , "rm" },
456
472
Annotations : authNeededAnnotation ,
457
- Args : cobra .NoArgs ,
458
- Short : "Reads a docker-compose.yml file and deletes services from the cluster" ,
473
+ Args : cobra .NoArgs , // TODO: takes optional list of service names
474
+ Short : "Reads a Compose file and deletes services from the cluster" ,
459
475
RunE : func (cmd * cobra.Command , args []string ) error {
460
476
var filePath , _ = cmd .InheritedFlags ().GetString ("file" )
461
477
var tail , _ = cmd .Flags ().GetBool ("tail" )
@@ -485,8 +501,8 @@ var composeDownCmd = &cobra.Command{
485
501
486
502
var composeConfigCmd = & cobra.Command {
487
503
Use : "config" ,
488
- Args : cobra .NoArgs ,
489
- Short : "Reads a docker-compose.yml file and shows the generated config" ,
504
+ Args : cobra .NoArgs , // TODO: takes optional list of service names
505
+ Short : "Reads a Compose file and shows the generated config" ,
490
506
RunE : func (cmd * cobra.Command , args []string ) error {
491
507
var filePath , _ = cmd .InheritedFlags ().GetString ("file" )
492
508
@@ -529,6 +545,20 @@ var deleteCmd = &cobra.Command{
529
545
},
530
546
}
531
547
548
+ var restartCmd = & cobra.Command {
549
+ Use : "restart" ,
550
+ Annotations : authNeededAnnotation ,
551
+ Args : cobra .MinimumNArgs (1 ),
552
+ Short : "Restart one or more services" ,
553
+ RunE : func (cmd * cobra.Command , args []string ) error {
554
+ _ , err := cli .Restart (cmd .Context (), client , args ... )
555
+ if err != nil {
556
+ return err
557
+ }
558
+ return nil
559
+ },
560
+ }
561
+
532
562
var sendCmd = & cobra.Command {
533
563
Use : "send" ,
534
564
Hidden : true , // not available in private beta
@@ -624,6 +654,7 @@ func main() {
624
654
secretsCmd .AddCommand (secretsListCmd )
625
655
626
656
rootCmd .AddCommand (secretsCmd )
657
+ rootCmd .AddCommand (restartCmd )
627
658
628
659
// Compose Command
629
660
composeCmd .PersistentFlags ().StringP ("file" , "f" , "*compose.y*ml" , `Compose file path` )
@@ -643,6 +674,7 @@ func main() {
643
674
composeStartCmd .Flags ().Bool ("force" , false , "Force a build of the image even if nothing has changed" )
644
675
composeCmd .AddCommand (composeStartCmd )
645
676
rootCmd .AddCommand (composeCmd )
677
+ composeCmd .AddCommand (composeRestartCmd )
646
678
647
679
// Tail Command
648
680
tailCmd .Flags ().StringP ("name" , "n" , "" , "Name of the service" )
0 commit comments