Skip to content

Commit 7d9b130

Browse files
refactor(cli): cleanup of aliases (#316)
standardize on camelCase for cli option names (while still supporting existing names with aliases)
1 parent c2121ca commit 7d9b130

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

.github/workflows/build.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,11 @@ jobs:
138138
path: lib/
139139
- run: npm uninstall @opentdf/client && npm ci && npm i ../lib/opentdf-client-*.tgz
140140
- run: npm install
141-
- run: npm test
142141
- run: npm audit --omit dev && npm audit --audit-level high --omit dev
143142
- run: npm run license-check
144143
- run: npm run lint
144+
- run: npx playwright install
145+
- run: npm test
145146
- run: npm pack
146147

147148
scripts:

cli/src/cli.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ function addParams(client: AnyNanoClient, argv: Partial<mainArgs>) {
9595
if (argv.attributes?.length) {
9696
client.dataAttributes = argv.attributes.split(',');
9797
}
98-
if (argv['users-with-access']?.length) {
99-
client.dissems = argv['users-with-access'].split(',');
98+
if (argv.usersWithAccess?.length) {
99+
client.dissems = argv.usersWithAccess.split(',');
100100
}
101101
log('SILLY', `Built encrypt params dissems: ${client.dissems}, attrs: ${client.dataAttributes}`);
102102
}
@@ -112,8 +112,8 @@ async function tdf3EncryptParamsFor(argv: Partial<mainArgs>): Promise<EncryptPar
112112
if (argv.attributes?.length) {
113113
c.setAttributes(argv.attributes.split(','));
114114
}
115-
if (argv['users-with-access']?.length) {
116-
c.setUsersWithAccess(argv['users-with-access'].split(','));
115+
if (argv.usersWithAccess?.length) {
116+
c.setUsersWithAccess(argv.usersWithAccess.split(','));
117117
}
118118
// use offline mode, we do not have upsert for v2
119119
c.setOffline();
@@ -145,8 +145,8 @@ export const handleArgs = (args: string[]) => {
145145
.middleware((argv) => {
146146
if (argv.silent) {
147147
log.level = 'CRITICAL';
148-
} else if (argv['log-level']) {
149-
const ll = argv['log-level'] as string;
148+
} else if (argv.logLevel) {
149+
const ll = argv.logLevel as string;
150150
log.level = ll.toUpperCase() as Level;
151151
}
152152
})
@@ -230,7 +230,8 @@ export const handleArgs = (args: string[]) => {
230230

231231
// POLICY
232232
.options({
233-
'users-with-access': {
233+
usersWithAccess: {
234+
alias: 'users-with-access',
234235
group: 'Policy Options',
235236
desc: 'Add users to the policy',
236237
type: 'string',
@@ -248,7 +249,8 @@ export const handleArgs = (args: string[]) => {
248249

249250
// COMMANDS
250251
.options({
251-
'log-level': {
252+
logLevel: {
253+
alias: 'log-level',
252254
type: 'string',
253255
default: 'info',
254256
desc: 'Set logging level',

remote-store/tests/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { expect } from '@esm-bundle/chai';
1+
import { expect } from 'chai';
22

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

0 commit comments

Comments
 (0)