https://github.com/rumkin/cli-complete
Missing node.js/io.js bash completion tool
https://github.com/rumkin/cli-complete
Last synced: 12 months ago
JSON representation
Missing node.js/io.js bash completion tool
- Host: GitHub
- URL: https://github.com/rumkin/cli-complete
- Owner: rumkin
- Created: 2015-06-25T18:56:16.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2015-06-26T10:16:31.000Z (almost 11 years ago)
- Last Synced: 2025-06-01T14:14:17.198Z (about 1 year ago)
- Language: JavaScript
- Size: 113 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Bash completion
Missed cli completion tool for node.js. Just place `cli-complete.js` into home directory to enable bash completion
for your local application.
# Install
Completion works only if installed globally because it writes file into `/etc/bash_completion.d/`.
```bash
npm install cli-completion -g
```
# Usage
Create `cli-completion.js` inside your project's directory. Example:
```javascript
if (process.argv.length === 3) {
console.log("server generate dump");
}
```
Type `node` or `iojs` first then script name and after that use `[TAB]`.
```
> node app[TAB] # -> app.js
> node app.js serv[TAB] # -> server
```
Or using `cli-completion` helper:
```javascript
var complete = require('cli-complete');
complete({
server: ['start', 'stop', 'reload'],
generate: ['view', 'controller'],
dump: true,
restore: function(){
// Output complete value
console.log('today yesterday');
}
})
```
# Note
Currently for unix systems only.