This repository has been archived by the owner on Nov 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 252
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add json output format to several commands
- docker context ls - docker ps - docker compose ls - docker compose ps - docker secret ls - docker volume ls - docker version Signed-off-by: Ulysses Souza <[email protected]>
- Loading branch information
1 parent
abd6af6
commit 8961805
Showing
23 changed files
with
664 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
Copyright 2020 Docker Compose CLI authors | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package compose | ||
|
||
import ( | ||
"bytes" | ||
"testing" | ||
|
||
"gotest.tools/assert" | ||
"gotest.tools/golden" | ||
|
||
"github.com/docker/compose-cli/api/compose" | ||
"github.com/docker/compose-cli/formatter" | ||
) | ||
|
||
func TestPrintComposeList(t *testing.T) { | ||
secretList := []compose.Stack{ | ||
{ | ||
ID: "123", | ||
Name: "myName123", | ||
Status: "Running", | ||
}, | ||
} | ||
out := &bytes.Buffer{} | ||
assert.NilError(t, printListFormatted(formatter.PRETTY, out, secretList)) | ||
golden.Assert(t, out.String(), "compose-list-out.golden") | ||
|
||
out.Reset() | ||
assert.NilError(t, printListFormatted(formatter.JSON, out, secretList)) | ||
golden.Assert(t, out.String(), "compose-list-out-json.golden") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[ | ||
{ | ||
"ID": "123", | ||
"Name": "myName123", | ||
"Status": "Running" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
NAME STATUS | ||
myName123 Running |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.