Skip to content

Commit

Permalink
fix: build
Browse files Browse the repository at this point in the history
  • Loading branch information
aryanjassal committed Oct 21, 2024
1 parent 6e8bc69 commit 0d604b8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions src/utils/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* but not the default value
* @module
*/
import commander from 'commander';
import commander, { InvalidArgumentError } from 'commander';
import config from 'polykey/dist/config';
import * as binParsers from '../utils/parsers';

Expand Down Expand Up @@ -214,7 +214,13 @@ const envVariables = new commander.Option('-e --env <envs...>', 'specify envs')
.argParser(
(value: string, previous: Array<[string, string, string?]> | undefined) => {
const acc = previous ?? [];
acc.push(binParsers.parseSecretPathEnv(value));
const [vault, secret, val] = binParsers.parseSecretPathEnv(value);
if (secret == null) {
throw new InvalidArgumentError(
'You must provide at least one secret path',
);
}
acc.push([vault, secret, val]);
return acc;
},
);
Expand Down
2 changes: 1 addition & 1 deletion tests/secrets/env.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ describe('commandEnv', () => {
'parse secrets env arguments',
async (secretPathEnvArray, cmd, cmdArgsArray) => {
let output:
| [Array<[string, string, string?]>, Array<string>]
| [Array<[string, string?, string?]>, Array<string>]
| undefined = undefined;
const args: Array<string> = [
...secretPathEnvArray,
Expand Down

0 comments on commit 0d604b8

Please sign in to comment.