File tree 3 files changed +8
-11
lines changed
3 files changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ class HelpCommand extends Command
18
18
'start {container} ' => 'Start the provided stopped containers (by ID) ' ,
19
19
'stop ' => 'Stop a running container from a list of options (optionally pass --all flag) ' ,
20
20
'stop {container} ' => 'Stop the provided running containers (by ID) ' ,
21
- 'list ' => 'List all enabled services (optionally pass --json flag) ' ,
21
+ 'list ' => 'List all enabled services (optionally pass --json or --networking flag) ' ,
22
22
'logs {container} ' => 'Display container logs (by ID) ' ,
23
23
];
24
24
Original file line number Diff line number Diff line change @@ -11,14 +11,14 @@ class ListCommand extends Command
11
11
{
12
12
use InitializesCommands;
13
13
14
- protected $ signature = 'list {--json} ' ;
14
+ protected $ signature = 'list {--json} {--networking} ' ;
15
15
protected $ description = 'List all services enabled by Takeout. ' ;
16
16
17
17
public function handle (Docker $ docker ): void
18
18
{
19
19
$ this ->initializeCommand ();
20
20
21
- $ containersCollection = $ docker ->takeoutContainers ();
21
+ $ containersCollection = $ docker ->takeoutContainers (boolval ( $ this -> option ( ' networking ' )) );
22
22
23
23
if ($ this ->option ('json ' )) {
24
24
$ this ->line ($ containersCollection ->map (function ($ item ) {
Original file line number Diff line number Diff line change @@ -98,15 +98,12 @@ public function allContainers(): Collection
98
98
);
99
99
}
100
100
101
- public function takeoutContainers (): Collection
101
+ public function takeoutContainers (bool $ withNetworking = false ): Collection
102
102
{
103
- $ process = sprintf (
104
- 'docker ps -a --filter "name=TO-" --format "table %s|%s" ' ,
105
- '{{.ID}}|{{.Names}}|{{.Status}}|{{.Ports}} ' ,
106
- '{{.Label \"com.tighten.takeout.Base_Alias\"}}|{{.Label \"com.tighten.takeout.Full_Alias\"}} '
107
- );
108
-
109
- return $ this ->runAndParseTable ($ process );
103
+ return $ this ->runAndParseTable (sprintf (
104
+ 'docker ps -a --filter \'name=TO- \' --format \'table {{.ID}}|{{.Names}}|{{.Status}}|{{.Ports}}%s \'' ,
105
+ $ withNetworking ? '|{{.Label "com.tighten.takeout.Base_Alias"}}|{{.Label "com.tighten.takeout.Full_Alias"}} ' : '' ,
106
+ ));
110
107
}
111
108
112
109
public function startableTakeoutContainers (): Collection
You can’t perform that action at this time.
0 commit comments