Skip to content
This repository has been archived by the owner on Jan 2, 2022. It is now read-only.

Commit

Permalink
chore: apply autocomplete (#66)
Browse files Browse the repository at this point in the history
* docs: update readme.md

* chore: autocomplete auto setup
  • Loading branch information
HaruHuey authored and Wonyoung Chae committed Sep 27, 2019
1 parent 5aaa96b commit 622bde5
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 2 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,24 @@ COMMANDS
node get node status
```


### How to Setup Henesis AutoComplete

```
$ henesis autocomplete
```

Enter the following script according to your shell type.

zsh:
> $ printf "$(henesis autocomplete:script zsh)" >> ~/.zshrc; source ~/.zshrc

bash:
> $ printf "$(henesis autocomplete:script bash)" >> ~/.bashrc; source ~/.bashrc


## Usage

### help
Expand Down
25 changes: 25 additions & 0 deletions bin/setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash

shell_env="$SHELL"
{
henesis="$(henesis autocomplete:script)"
} || {
henesis="$(node bin/run autocomplete:script)"
}


if [[ "${shell_env}"=="/bin/zsh" ]]; then
cat_for_zsh=`cat ~/.zshrc`

if [[ "${cat_for_zsh}" != *"${henesis}"* ]]; then
printf "${henesis}" >> ~/.zshrc; source ~/.zshrc
fi
fi

if [[ "${shell_env}"=="/bin/bash" ]]; then
cat_for_bash=`cat ~/.bashrc`

if [[ "${cat_for_bash}" != *"${henesis}"* ]]; then
printf "${henesis}" >> ~/.bashrc; source ~/.bashrc
fi
fi
1 change: 1 addition & 0 deletions bin/setup.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@echo off
9 changes: 9 additions & 0 deletions bin/setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const os = require('os');

if (os.type() === 'Windows_NT') {
const exec = require('child_process').exec;
exec('%cd%/bin/setup.cmd', function callback(error, stdout, stderr) {});
} else {
const exec = require('child_process').exec;
exec('sh ./bin/setup', function callback(error, stdout, stderr) {});
}
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"@oclif/command": "^1.5.13",
"@oclif/config": "^1.12.12",
"@oclif/plugin-help": "^2.1.6",
"@oclif/plugin-autocomplete": "^0.1.4",
"@types/configstore": "^4.0.0",
"@types/js-yaml": "^3.12.1",
"@types/universal-analytics": "^0.4.2",
Expand Down Expand Up @@ -88,7 +89,8 @@
"commands": "./lib/commands",
"bin": "henesis",
"plugins": [
"@oclif/plugin-help"
"@oclif/plugin-help",
"@oclif/plugin-autocomplete"
],
"hooks": {
"init": "./lib/hooks/init/wretch"
Expand All @@ -109,7 +111,8 @@
"prepack": "tsc -b && oclif-dev manifest && oclif-dev readme",
"test": "export HENESIS_TEST='true' && nyc --extension .ts mocha --forbid-only \"src/**/*.spec.ts\" --timeout 20000",
"version": "oclif-dev readme && git add README.md",
"lint": "tsc --noEmit && eslint '*/**/*.{js,ts,tsx}' --quiet --fix"
"lint": "tsc --noEmit && eslint '*/**/*.{js,ts,tsx}' --quiet --fix",
"postinstall": "node ./bin/setup.js"
},
"types": "lib/index.d.ts"
}

0 comments on commit 622bde5

Please sign in to comment.