# cache-sh

> CLI tool to use cache for cli-commands to prevent long running commands from executing unnecessarily

Latest version **1.3.1** (published 2024-02-21) · ISC license · 0 weekly downloads

## Install

```sh
npm install cache-sh
pnpm add cache-sh
yarn add cache-sh
bun add cache-sh
```

Provides the command `cache-sh`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.1 |
| Published | 2024-02-21 |
| First published | 2023-12-05 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 30.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Albert Groothedde |
| Maintainers | alber70g |

## Links

- npm: https://www.npmjs.com/package/cache-sh
- npm.io page: https://npm.io/package/cache-sh

## Dependencies (3)

- [glob](https://npm.io/package/glob.md) ^10.3.10
- [debug](https://npm.io/package/debug.md) ^4.3.4
- [commander](https://npm.io/package/commander.md) ^11.1.0

## Recent versions

- 1.3.1 (latest) — 2024-02-21
- 1.3.0 — 2024-02-21
- 1.2.2 — 2024-02-20
- 1.2.1 — 2024-02-15
- 1.2.0 — 2024-02-15
- 1.1.0 — 2023-12-07
- 1.0.4 — 2023-12-05
- 1.0.3 — 2023-12-05
- 1.0.2 — 2023-12-05
- 1.0.1 — 2023-12-05
- 1.0.0 — 2023-12-05

## README

# cache-sh

cache-sh is a command line tool for caching shell commands. It can be used to
cache the results of any shell command, reducing the time it takes to run
repetitive tasks.

### [Changelog](https://github.com/alber70g/cache-sh/blob/master/changelog.md)

## Installation

```bash
npm install -g cache-sh
```

## Usage

Here are some examples of how you can use `cache-sh` with `prisma generate` and
`tsc`.

### Prisma Generate

```bash
cache-sh -i "{./prisma/schema.prisma,node_modules/**/.prisma/client/**/*.*}" \
pnpm prisma generate
```

In this example cache-sh will check if the `prisma/schema.prisma` file AND the
generated `.prisma/client` has changed and exists, since the last time
`prisma generate` was run.

If it hasn't, `cache-sh` will skip running the command and use the cached result
instead.

### TypeScript Compilation

```bash
cache-sh -i "{src/**/*,dist/**/*}" tsc
```

In this example, cache-sh will check if any `.ts` files in the `src` directory
have changed since the last time `tsc` was run. If they haven't, cache-sh will
skip running the command and assume you can use what's already there, instead.

## Usage

```sh
cache-sh [options] -- <command...>
cache-sh [options] <command...>
```

## Options

- `-V, --version` output the version number
- `-i, --input <input>` glob that's used as input to check whether the existing
  files need to be updated
- `-C, --config <path>` set the config path (default: `(pwd)/.cache-sh`)
- `-d, --cwd <path>` set the current working directory
- `-f, --force` ignore the cache the command
- `-c, --clear` clear the cache
- `-h, --help` display help for command

Examples:

```sh
$ cache-sh -i "{src/**,dist/**}" -- tsc
$ cache-sh -i hi.log -- "sleep 2 && echo "hi" > hi.log"
$ cache-sh -i "{./prisma/schema.prisma,node_modules/**/.prisma/client/**/*.*}"\
-- pnpm prisma generate
```

---
_Source: https://npm.io/package/cache-sh · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
