Skip to content

Commit

Permalink
refactor: use positional arguments for env-file
Browse files Browse the repository at this point in the history
change is done for better ergonomics, as the env-file is always required

BREAKING CHANGE: run/inspect commands have changed. previously the locked env-file was passed with
-e/--env option. Now its required to be passed as the first argument to the commands respectively
  • Loading branch information
nutgaard committed Jun 18, 2024
1 parent 812d78c commit ab16bc7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/commands/inspect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import { getKeyVerifier } from '../utils/persistent-unlock';

export const inspectCommand: Command = program
.createCommand('inspect')
.option('-e, --env <env_file>', 'View content of envview')
.action(async (options) => {
.argument('<env_file>', 'File to inspect')
.action(async (envFile) => {
const fs = getFS();
const dirname = path.dirname(options.env);
const dirname = path.dirname(envFile);
const unlockfile = path.join(dirname, '.dktp.unlocked');
const vaultFile: CipherData = await fs.file(options.env).json();
const vaultFile: CipherData = await fs.file(envFile).json();

const { keyVerifier, updatedValue } = await getKeyVerifier(unlockfile, vaultFile);
const [key, verifier] = keyVerifier;
Expand Down
8 changes: 4 additions & 4 deletions src/commands/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import { getKeyVerifier } from '../utils/persistent-unlock';

export const runCommand: Command = program
.createCommand('run')
.option('-e, --env <env_file>', 'Envfile to use for interpolation')
.argument('<env_file>', 'Envfile to use for process')
.argument('<command...>', 'The command to run')
.action(async (cmds, options) => {
.action(async (envFile, cmds) => {
const fs = getFS();
const dirname = path.dirname(options.env);
const dirname = path.dirname(envFile);
const unlockfile = path.join(dirname, '.dktp.unlocked');
const vaultFile: CipherData = await fs.file(options.env).json();
const vaultFile: CipherData = await fs.file(envFile).json();

const { keyVerifier, updatedValue } = await getKeyVerifier(unlockfile, vaultFile);
const [key, verifier] = keyVerifier;
Expand Down

0 comments on commit ab16bc7

Please sign in to comment.