From 0dd4811c6b57f8e2ac0284701ed85108fd1e7947 Mon Sep 17 00:00:00 2001 From: Samantha Gottlieb Date: Wed, 21 Jul 2021 15:05:27 +0100 Subject: [PATCH] feat: Make cli verbose by default --- src/bin/commands/account-readiness.ts | 17 +++-------------- src/bin/commands/aws-cdk-version.ts | 4 ++-- src/bin/index.ts | 7 +++---- 3 files changed, 8 insertions(+), 20 deletions(-) diff --git a/src/bin/commands/account-readiness.ts b/src/bin/commands/account-readiness.ts index da6e016fdd..39266a37a4 100644 --- a/src/bin/commands/account-readiness.ts +++ b/src/bin/commands/account-readiness.ts @@ -6,11 +6,9 @@ import type { CliCommandResponse } from "../../types/command"; export const accountReadinessCommand = async ({ credentialProvider, region, - verbose, }: { credentialProvider: CredentialProviderChain; region: string; - verbose: boolean; }): CliCommandResponse => { const ssm = new AWS.SSM({ credentialProvider, @@ -22,18 +20,9 @@ export const accountReadinessCommand = async ({ const awsResponse = await ssm.getParameters({ Names: paths }).promise(); - const foundParameters = awsResponse.Parameters ?? []; const notFoundParameters = awsResponse.InvalidParameters ?? []; - if (!verbose) { - const messagePrefix = notFoundParameters.length === 0 ? "OK" : "ACTION NEEDED"; - - return Promise.resolve( - `[${messagePrefix}] ${foundParameters.length}/${ssmParams.length} SSM parameters found. ${notFoundParameters.length}/${ssmParams.length} SSM parameters not found.` - ); - } else { - const notFoundInDetail = ssmParams.filter((_) => notFoundParameters.includes(_.path)); - const foundInDetail = ssmParams.filter((_) => !notFoundParameters.includes(_.path)); - return Promise.resolve({ found: foundInDetail, notFound: notFoundInDetail }); - } + const notFoundInDetail = ssmParams.filter((_) => notFoundParameters.includes(_.path)); + const foundInDetail = ssmParams.filter((_) => !notFoundParameters.includes(_.path)); + return Promise.resolve({ found: foundInDetail, notFound: notFoundInDetail }); }; diff --git a/src/bin/commands/aws-cdk-version.ts b/src/bin/commands/aws-cdk-version.ts index 2785e39f3c..ba29af249b 100644 --- a/src/bin/commands/aws-cdk-version.ts +++ b/src/bin/commands/aws-cdk-version.ts @@ -1,6 +1,6 @@ import { LibraryInfo } from "../../constants/library-info"; import type { CliCommandResponse } from "../../types/command"; -export const awsCdkVersionCommand = (verbose: boolean): CliCommandResponse => { - return Promise.resolve(verbose ? LibraryInfo.AWS_CDK_VERSIONS : LibraryInfo.AWS_CDK_VERSION); +export const awsCdkVersionCommand = (): CliCommandResponse => { + return Promise.resolve(LibraryInfo.AWS_CDK_VERSIONS); }; diff --git a/src/bin/index.ts b/src/bin/index.ts index 20676b3962..76bcc25184 100755 --- a/src/bin/index.ts +++ b/src/bin/index.ts @@ -22,7 +22,6 @@ const parseCommandLineArguments = () => { return Promise.resolve( yargs .usage("$0 COMMAND [args]") - .option("verbose", { type: "boolean", default: false, description: "Show verbose output" }) .option("profile", { type: "string", description: "AWS profile" }) .option("region", { type: "string", description: "AWS region", default: "eu-west-1" }) .command(Commands.AwsCdkVersion, "Print the version of @aws-cdk libraries being used") @@ -37,12 +36,12 @@ const parseCommandLineArguments = () => { parseCommandLineArguments() .then((argv): CliCommandResponse => { const command = argv._[0]; - const { verbose, profile, region } = argv; + const { profile, region } = argv; switch (command) { case Commands.AwsCdkVersion: - return awsCdkVersionCommand(verbose); + return awsCdkVersionCommand(); case Commands.AccountReadiness: - return accountReadinessCommand({ credentialProvider: awsCredentialProviderChain(profile), region, verbose }); + return accountReadinessCommand({ credentialProvider: awsCredentialProviderChain(profile), region }); default: throw new Error(`Unknown command: ${command}`); }