From 7d9b13064dc470280d3f4cbfa0a529c13469e2c4 Mon Sep 17 00:00:00 2001 From: Dave Mihalcik Date: Mon, 5 Aug 2024 16:39:38 -0400 Subject: [PATCH] refactor(cli): cleanup of aliases (#316) standardize on camelCase for cli option names (while still supporting existing names with aliases) --- .github/workflows/build.yaml | 3 ++- cli/src/cli.ts | 18 ++++++++++-------- remote-store/tests/index.test.ts | 2 +- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 6f8fe1d3..2469388c 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -138,10 +138,11 @@ jobs: path: lib/ - run: npm uninstall @opentdf/client && npm ci && npm i ../lib/opentdf-client-*.tgz - run: npm install - - run: npm test - run: npm audit --omit dev && npm audit --audit-level high --omit dev - run: npm run license-check - run: npm run lint + - run: npx playwright install + - run: npm test - run: npm pack scripts: diff --git a/cli/src/cli.ts b/cli/src/cli.ts index cb315568..2a596133 100644 --- a/cli/src/cli.ts +++ b/cli/src/cli.ts @@ -95,8 +95,8 @@ function addParams(client: AnyNanoClient, argv: Partial) { if (argv.attributes?.length) { client.dataAttributes = argv.attributes.split(','); } - if (argv['users-with-access']?.length) { - client.dissems = argv['users-with-access'].split(','); + if (argv.usersWithAccess?.length) { + client.dissems = argv.usersWithAccess.split(','); } log('SILLY', `Built encrypt params dissems: ${client.dissems}, attrs: ${client.dataAttributes}`); } @@ -112,8 +112,8 @@ async function tdf3EncryptParamsFor(argv: Partial): Promise { .middleware((argv) => { if (argv.silent) { log.level = 'CRITICAL'; - } else if (argv['log-level']) { - const ll = argv['log-level'] as string; + } else if (argv.logLevel) { + const ll = argv.logLevel as string; log.level = ll.toUpperCase() as Level; } }) @@ -230,7 +230,8 @@ export const handleArgs = (args: string[]) => { // POLICY .options({ - 'users-with-access': { + usersWithAccess: { + alias: 'users-with-access', group: 'Policy Options', desc: 'Add users to the policy', type: 'string', @@ -248,7 +249,8 @@ export const handleArgs = (args: string[]) => { // COMMANDS .options({ - 'log-level': { + logLevel: { + alias: 'log-level', type: 'string', default: 'info', desc: 'Set logging level', diff --git a/remote-store/tests/index.test.ts b/remote-store/tests/index.test.ts index 5944cca8..fc573b7c 100644 --- a/remote-store/tests/index.test.ts +++ b/remote-store/tests/index.test.ts @@ -1,4 +1,4 @@ -import { expect } from '@esm-bundle/chai'; +import { expect } from 'chai'; import { setRemoteStoreAsStream } from '../src/index.js';