Skip to content

Commit

Permalink
Fix cmd output
Browse files Browse the repository at this point in the history
  • Loading branch information
CrazyMax committed Aug 21, 2020
1 parent 04f461c commit 16d491f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
15 changes: 10 additions & 5 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 8 additions & 5 deletions src/aws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ export const isECR = async (registry: string): Promise<boolean> => {
return registry.includes('amazonaws');
};

export const getRegion = async (registry: string): Promise<string> => {
return registry.substring(registry.indexOf('ecr.') + 4, registry.indexOf('.amazonaws'));
};

export const getCLI = async (): Promise<string> => {
return io.which('aws', true);
};
Expand All @@ -14,8 +18,11 @@ export const getCLICmdOutput = async (args: string[]): Promise<string> => {
return execm.exec(await getCLI(), args, true).then(res => {
if (res.stderr != '' && !res.success) {
throw new Error(res.stderr);
} else if (res.stderr != '') {
return res.stderr.trim();
} else {
return res.stdout.trim();
}
return res.stdout;
});
};

Expand All @@ -30,7 +37,3 @@ export const parseCLIVersion = async (stdout: string): Promise<string | undefine
}
return undefined;
};

export const getRegion = async (registry: string): Promise<string> => {
return registry.substring(registry.indexOf('ecr.') + 4, registry.indexOf('.amazonaws'));
};

0 comments on commit 16d491f

Please sign in to comment.