Compare commits

..

2 Commits

Author SHA1 Message Date
CrazyMax
f78f708678 Merge pull request #57 from crazy-max/fix-docker-context
Some checks failed
publish / publish (push) Has been cancelled
docker: fix context command
2023-02-25 17:50:03 +01:00
CrazyMax
6fe7d54029 docker: fix context command
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-02-25 16:40:35 +01:00
2 changed files with 7 additions and 3 deletions

View File

@@ -63,7 +63,7 @@ describe('context', () => {
await Docker.context().catch(() => {
// noop
});
expect(execSpy).toHaveBeenCalledWith(`docker`, ['context', 'show'], {
expect(execSpy).toHaveBeenCalledWith(`docker`, ['context', 'inspect', '--format', '{{.Name}}'], {
ignoreReturnCode: true,
silent: true
});

View File

@@ -38,8 +38,12 @@ export class Docker {
});
}
public static async context(): Promise<string> {
return await Exec.getExecOutput(`docker`, ['context', 'show'], {
public static async context(name?: string): Promise<string> {
const args = ['context', 'inspect', '--format', '{{.Name}}'];
if (name) {
args.push(name);
}
return await Exec.getExecOutput(`docker`, args, {
ignoreReturnCode: true,
silent: true
}).then(res => {