docker: fix context command
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
@@ -63,7 +63,7 @@ describe('context', () => {
|
|||||||
await Docker.context().catch(() => {
|
await Docker.context().catch(() => {
|
||||||
// noop
|
// noop
|
||||||
});
|
});
|
||||||
expect(execSpy).toHaveBeenCalledWith(`docker`, ['context', 'show'], {
|
expect(execSpy).toHaveBeenCalledWith(`docker`, ['context', 'inspect', '--format', '{{.Name}}'], {
|
||||||
ignoreReturnCode: true,
|
ignoreReturnCode: true,
|
||||||
silent: true
|
silent: true
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -38,8 +38,12 @@ export class Docker {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async context(): Promise<string> {
|
public static async context(name?: string): Promise<string> {
|
||||||
return await Exec.getExecOutput(`docker`, ['context', 'show'], {
|
const args = ['context', 'inspect', '--format', '{{.Name}}'];
|
||||||
|
if (name) {
|
||||||
|
args.push(name);
|
||||||
|
}
|
||||||
|
return await Exec.getExecOutput(`docker`, args, {
|
||||||
ignoreReturnCode: true,
|
ignoreReturnCode: true,
|
||||||
silent: true
|
silent: true
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
|
|||||||
Reference in New Issue
Block a user