Skip to content

Commit

Permalink
docs: add example usage svgs using termtosvg
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob-shuman committed May 21, 2022
1 parent 96614f7 commit 681eed8
Show file tree
Hide file tree
Showing 5 changed files with 475 additions and 115 deletions.
37 changes: 34 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ _**Run npm scripts using automatically shortened script names**_
unscript [options] [query]
```


## What is unscript?

Unscript lets you query and run npm scripts from a list of shorthands. These shorthands are generated from the names of the scripts in your `package.json`. Unscript creates shorthands by combining the first letter of each word separated by a delimiter (`:` by default).

For example:
Expand All @@ -37,6 +37,7 @@ For example:
If no query is passed then a list of all scripts in the `package.json` will be displayed.

## Why was this made?

There are many existing tools on npm that can run javascript files easily as a drop-in replacement for package.json scripts. Although these are helpful utilities I found that I wanted to create many small package.json scripts that I wouldn't need a full javascript file for. Unscript was created out of my own personal desire to quick run npm scripts using automatically generated shortened names.

## Options
Expand All @@ -48,9 +49,15 @@ There are many existing tools on npm that can run javascript files easily as a d
| `-a`, `--auto` | `false` | Run the selected script without confirmation. |
| `-s`, `--scripts` | `false` | Display scripts in found package.json. |

## Usage
## Installation

Unscript can be run using npx:
Unscript can be used by installing it globally

```bash
npm i -g unscript
```

or by using using npx:

```bash
npx unscript lw
Expand All @@ -62,3 +69,27 @@ to save time writing that out it is recommended to alias the command to a shorte
# .bashrc .zshrc ...etc
alias un='npx unscript'
```

## Usage

### Basic usage

In this case the `dev` script is run because `dev` is the only script that was automatically shortened to `d`.

```
unscript d
```

![basic shorthand example usage](examples/shorthand.svg)

### Handling multiple scripts with the same generated shorthands

When multiple scripts have the same generated shorthand then a prompt will appear to ask which of the results should be run.

![name collision example](examples/name-collision.svg)

### Run the selected script without prompting

Using the `-a` (auto) option will run the selected script without prompting for confirmation if there is only one script matching the shorthand query.

![auto option example](examples/auto-option.svg)
129 changes: 129 additions & 0 deletions examples/auto-option.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
184 changes: 72 additions & 112 deletions examples/full.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
109 changes: 109 additions & 0 deletions examples/name-collision.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
131 changes: 131 additions & 0 deletions examples/shorthand.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 681eed8

Please sign in to comment.