Skip to content

v0.5.0

Latest

Choose a tag to compare

@tolgamorf tolgamorf released this 24 Sep 04:53
· 1 commit to main since this release

What's New

fix: exit 130 on cancel, and stop on Ctrl-C wherever it lands

A cancel now has its own exit code, apart from a No:

0 done
1 failed
2 declined: No at a prompt, or no terminal to answer it
130 cancelled: Escape or Ctrl-C at a prompt, or Ctrl-C while running

so a script running env2op over several files can skip a file on 2 and stop
the whole run on 130. confirm() now answers yes/no/cancel; before, a cancel
collapsed into a No and exited 2. The --update prompt follows the same
rules: a cancel exits 130, no terminal exits 2.

Ctrl-C outside a prompt did not stop the command:

  • On a terminal, a running clack spinner puts stdin in raw mode, reads
    Ctrl-C (and Escape) as a key and answers it with process.exit(0), so a
    cancelled push reported success. A keypress listener added at startup
    notes the cancel key, and an exit listener turns that exit 0 into 130.
  • Without a terminal, SIGINT reached the spinner's own handler, which only
    stops the spinner, and any handler turns off the default exit: the
    command went on to create the item and write the template. A SIGINT
    handler now exits 130 (SIGTERM 143), and no new op call starts once it
    has fired.

Exiting on an interrupt skips finally, so the temp file holding the
values in plain text, and op2env's masked template, are now also deleted
from an exit listener. Importing the package still adds no listeners; the
bins install them.

The integration tests cover Yes, No, Escape, Ctrl-C, no terminal and -f at
each prompt of both bins, Ctrl-C and Escape during a spinner on a terminal,
SIGINT while op runs, and the temp file being gone afterwards.

chore: update manifests for v0.4.1


Installation

Homebrew (macOS/Linux)

brew install tolgamorf/tap/env2op-cli

Package Managers (macOS/Linux/Windows)

# Using bun
bun add -g @tolgamorf/env2op-cli

# Using npm
npm install -g @tolgamorf/env2op-cli

# Using pnpm
pnpm add -g @tolgamorf/env2op-cli