# npm-tabs

> Tabbable npm scripts

Latest version **1.0.2** (published 2019-03-29) · ISC license · 0 weekly downloads

## Install

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

## 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.0.2 |
| Published | 2019-03-29 |
| First published | 2019-03-29 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Dhiraj sriram |
| Maintainers | dhiraj3194 |
| Keywords | shell, npm, autocomplete, jq |

## Links

- npm: https://www.npmjs.com/package/npm-tabs
- Repository: https://github.com/dhirajsriram/Npm-tabs
- Homepage: https://github.com/dhirajsriram/Npm-tabs#readme
- Issues: https://github.com/dhirajsriram/Npm-tabs/issues
- npm.io page: https://npm.io/package/npm-tabs

## Recent versions

- 1.0.2 (latest) — 2019-03-29
- 1.0.1 — 2019-03-29
- 1.0.0 — 2019-03-29

## README

# npm-tabs

An autocompletion shell script that autocompletes the commands based on the scripts declared in the package.json file.

## Dependencies required

- Jq
- Terminal that runs shell script (Support for windows under development)

## Running

- After installing the package , use the following command in the root folder of your application

```
cd node_modules/npm-tabs ; tr -cd '[:alnum:][:blank:][:punct:]\n' < npm-tabs.sh > npm-tabs-min.sh ; source npm-tabs-min.sh
````
- It should automatically install the necessary dependencies

*If it says 'source' is not recognized as an internal or external command. Try running the command from a bash terminal*

cygWin - https://www.cygwin.com/<br/>
git -  https://git-scm.com/download/win

- Now while typing npm run (default command to run npm scripts) press tab to show the list of suggested commands

## Snippets

### Get the npm script names as an array
``` sh
sample=`cat package.json`
arr=()
arr=($(echo "${sample}" | jq -r ' .scripts |keys | join(" ")'))
```
### Autocomplete based on the array

``` sh
_UseGetOpt-2 ()
{
  local cur
  cur=${COMP_WORDS[COMP_CWORD]}
  COMPREPLY=( $( compgen -W '${arr[*]}' $cur))
  case "$cur" in
    -*)
    COMPREPLY=( $( compgen -W '-a -d -f -l -t -h --aoption --debug \
                               --file --log --test --help --' -- $cur ) );
  esac
  return 0
}

complete -F _UseGetOpt-2 -o filenames npm run
```

## Output

<p align="center">
  <img src="https://github.com/dhirajsriram/npm-tabs/blob/master/npmtabs.PNG?raw=true">
</p>

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