Skip to content

Commit

Permalink
refactor(cli): cleanup of aliases (#316)
Browse files Browse the repository at this point in the history
standardize on camelCase for cli option names (while still supporting existing names with aliases)
  • Loading branch information
dmihalcik-virtru authored Aug 5, 2024
1 parent c2121ca commit 7d9b130
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
18 changes: 10 additions & 8 deletions cli/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ function addParams(client: AnyNanoClient, argv: Partial<mainArgs>) {
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}`);
}
Expand All @@ -112,8 +112,8 @@ async function tdf3EncryptParamsFor(argv: Partial<mainArgs>): Promise<EncryptPar
if (argv.attributes?.length) {
c.setAttributes(argv.attributes.split(','));
}
if (argv['users-with-access']?.length) {
c.setUsersWithAccess(argv['users-with-access'].split(','));
if (argv.usersWithAccess?.length) {
c.setUsersWithAccess(argv.usersWithAccess.split(','));
}
// use offline mode, we do not have upsert for v2
c.setOffline();
Expand Down Expand Up @@ -145,8 +145,8 @@ export const handleArgs = (args: string[]) => {
.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;
}
})
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion remote-store/tests/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { expect } from '@esm-bundle/chai';
import { expect } from 'chai';

import { setRemoteStoreAsStream } from '../src/index.js';

Expand Down

0 comments on commit 7d9b130

Please sign in to comment.