Skip to content

Commit

Permalink
Merge pull request #57 from crazy-max/fix-docker-context
Browse files Browse the repository at this point in the history
docker: fix context command
  • Loading branch information
crazy-max committed Feb 25, 2023
2 parents 1cc5fc8 + 6fe7d54 commit f78f708
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion __tests__/docker.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
Expand Down
8 changes: 6 additions & 2 deletions src/docker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down

0 comments on commit f78f708

Please sign in to comment.