Skip to content

Commit 0d604b8

Browse files
committed
fix: build
1 parent 6e8bc69 commit 0d604b8

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/utils/options.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* but not the default value
66
* @module
77
*/
8-
import commander from 'commander';
8+
import commander, { InvalidArgumentError } from 'commander';
99
import config from 'polykey/dist/config';
1010
import * as binParsers from '../utils/parsers';
1111

@@ -214,7 +214,13 @@ const envVariables = new commander.Option('-e --env <envs...>', 'specify envs')
214214
.argParser(
215215
(value: string, previous: Array<[string, string, string?]> | undefined) => {
216216
const acc = previous ?? [];
217-
acc.push(binParsers.parseSecretPathEnv(value));
217+
const [vault, secret, val] = binParsers.parseSecretPathEnv(value);
218+
if (secret == null) {
219+
throw new InvalidArgumentError(
220+
'You must provide at least one secret path',
221+
);
222+
}
223+
acc.push([vault, secret, val]);
218224
return acc;
219225
},
220226
);

tests/secrets/env.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ describe('commandEnv', () => {
772772
'parse secrets env arguments',
773773
async (secretPathEnvArray, cmd, cmdArgsArray) => {
774774
let output:
775-
| [Array<[string, string, string?]>, Array<string>]
775+
| [Array<[string, string?, string?]>, Array<string>]
776776
| undefined = undefined;
777777
const args: Array<string> = [
778778
...secretPathEnvArray,

0 commit comments

Comments
 (0)