Skip to content

Commit

Permalink
[codeClimate]: getParameter tiny simplification
Browse files Browse the repository at this point in the history
  • Loading branch information
gagoar committed May 19, 2020
1 parent bf8ae3f commit 3624882
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/actions/getParameter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ interface Input extends Actions {
name: string
};

const getTupleFromParameter = (name: string, environment: string, { Value: value, LastModifiedDate: updatedAt, Version: version }: SSM.Parameter) => [[name, value, environment, dateFormat(updatedAt, DATE_FORMAT), version]];
export const getParameter = async ({ name, prefix, region = REGION, ci = false, environment = Environment.all }: Input): Promise<string> => {

const loader = ora(`retrieving key ${name} with the prefix /${prefix} (${region})`).start();
Expand All @@ -32,10 +33,8 @@ export const getParameter = async ({ name, prefix, region = REGION, ci = false,

if (response.Parameter) {

const { Value: value, LastModifiedDate: updatedAt, Version: version } = response.Parameter;

const style = ci ? DISABLE_TABLE_COLORS : undefined;
const content = createTable(customHeader, [[name, value, environment, dateFormat(updatedAt, DATE_FORMAT), version]], style);
const content = createTable(customHeader, getTupleFromParameter(name, environment, response.Parameter), style);

loader.stopAndPersist({ text: `${name} found under /${prefix} (${region})`, symbol: SUCCESS_SYMBOL });

Expand Down

0 comments on commit 3624882

Please sign in to comment.