From e892b6bb5d771ee8f796778e037fcc0ed089a596 Mon Sep 17 00:00:00 2001 From: Jacob Shuman <44483276+jacob-shuman@users.noreply.github.com> Date: Tue, 10 May 2022 23:34:06 -0400 Subject: [PATCH] docs: update readme --- README.md | 34 ++++++++++++++++++++++++++++++++++ src/index.ts | 4 ++-- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9d1e8f5..e763c5c 100644 --- a/README.md +++ b/README.md @@ -5,3 +5,37 @@ ▐█▄█▌ ██▐█▌ ▐█▄▪▐█ ▐███▌ ▐█•█▌ ▐█▌ ▐█▪·• ▐█▌· ▀▀▀ ▀▀ █▪ ▀▀▀▀ ·▀▀▀ .▀ ▀ ▀▀▀ .▀ ▀▀▀ ``` + +_**Run npm scripts using shorthands**_ + +Unscript lets you run npm scripts using shorthands generated from the names of scripts in your `package.json`. Unscript creates shorthands by combining the first letter of each word separated by a delimiter (`:` by default). + +For example: + +- `dev` would be shortened to `d`. +- `build:dev` would be shortened to `bd`. +- `lint:watch` would be shortened to `lw`. + +## Options + +| option | default | description | +| ------------------- | ------- | --------------------------------------------- | +| `-p`, `--path` | `"."` | Path to folder containing package.json. | +| `-d`, `--delimiter` | `":"` | Character to separate words by. | +| `-a`, `--auto` | `false` | Run the selected script without confirmation. | +| `-s`, `--scripts` | `false` | Display scripts in found package.json. | + +## Usage + +Unscript can be run using npx: + +```bash +npx unscript lw +``` + +to save time writing that out it is recommended to alias the command to a shorter name: + +```bash +# .bashrc .zshrc ...etc +alias un='npx unscript' +``` diff --git a/src/index.ts b/src/index.ts index 7434802..fc27bc0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -16,11 +16,11 @@ import prompts from "prompts"; program .version(packageJson.version, "-v, --version") .description(packageJson.description) - .addArgument(new Argument("shorthand")) + .addArgument(new Argument("query")) .option("-p, --path ", "Path to folder containing package.json.", ".") .option("-d, --delimiter ", "Character to separate words by.", ":") .option("-a, --auto", "Run the selected script without confirmation.", false) - .option("-s, --scripts", "Display scripts in found package.json", false) + .option("-s, --scripts", "Display scripts in found package.json.", false) .action( async ( query: string,