shelljs / shelljs/shx

Add a command to negate the exit code of some other command

Open
#173 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

feat
Dominant language
JavaScript
Stars
1.9k
Forks
51
Avg merge
3d 2h
Merged PRs (30d)
1

Description

I couldn't find any way to do this in a cross-platform way. POSIX shell has the ! operator that can do that, but I couldn't find a way to do it on Windows. It could work like an exec command that negates the exit code of the execution.

Sample use case: Stop a commit using husky if any file contains string DO_NOT_COMMIT_THIS. "pre-commit": "shx not grep -rq DO_NOT_COMMIT_THIS ."

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the existing exec command and the command-dispatch entry point, then trace how exit codes are handled on each supported platform. Use the proposed shx not grep -rq DO_NOT_COMMIT_THIS . example to define the expected behavior: the new command should execute its argument and negate the resulting exit code consistently on Windows and POSIX systems.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.