omelette
Advanced tools
Comparing version 0.4.12 to 0.4.14
@@ -10,4 +10,9 @@ { | ||
], | ||
"files": [ | ||
"src", | ||
"LICENSE", | ||
"README.md" | ||
], | ||
"author": "Fatih Kadir Akın <fka@fatihak.in>", | ||
"version": "0.4.12", | ||
"version": "0.4.14", | ||
"licenses": [ | ||
@@ -14,0 +19,0 @@ { |
<img src="https://rawgit.com/f/omelette/master/resources/logo.svg?v1" height="80"> | ||
> Omelette is a simple template based autocompletion tool for Node projects with super easy API. | ||
> Omelette is a simple template based autocompletion tool for **Node** and **Deno** projects with super easy API. | ||
@@ -14,2 +14,8 @@ [![npm version](https://badge.fury.io/js/omelette.svg)](https://badge.fury.io/js/omelette) | ||
You also can use Omelette with **Deno**: | ||
```typescript | ||
import omelette from "https://deno.land/x/omelette/omelette.ts"; | ||
``` | ||
You just have to decide your program name and CLI fragments. | ||
@@ -27,2 +33,4 @@ | ||
**For a step by step guide please follow [this link](https://github.com/f/omelette/issues/33#issuecomment-439864555)** | ||
Implementing omelette is very easy: | ||
@@ -216,2 +224,4 @@ | ||
> ⚠️ Not available for Deno runtime. You can make your users to put `yourprogram --completion | source` or `yourprogram --completion-fish | source` args explicitly to their shell config file. | ||
Installing and making your users install the autocompletion feature is very simple. | ||
@@ -245,2 +255,4 @@ | ||
> ⚠️ Not available for Deno runtime. Your users need to remove the autocompletion setup script from their shell config files. | ||
Similarly to installation, you can use `cleanupShellInitFile` to undo changes done by `setupShellInitFile`. | ||
@@ -256,21 +268,25 @@ | ||
*(You should add these instructions to your project's README)* | ||
#### Instructions for your README files: | ||
In **zsh**, you can write these: | ||
*(You should add these instructions to your project's README, don't forget to replace `myprogram` string with your own executable name)* | ||
In **zsh**, you should write these: | ||
```bash | ||
echo '. <(./githubber --completion)' >> .zshrc | ||
echo '. <(myprogram --completion)' >> ~/.zshrc | ||
``` | ||
In **bash**, you should write: | ||
In **bash**: | ||
On macOS, you may need to install `bash-completion` using `brew install bash-completion`. | ||
```bash | ||
./githubber --completion >> ~/githubber.completion.sh | ||
echo 'source ~/githubber.completion.sh' >> .bash_profile | ||
myprogram --completion >> ~/.config/hello.completion.sh | ||
echo 'source ~/.config/hello.completion.sh' >> ~/.bash_profile | ||
``` | ||
In **fish**, you can write: | ||
In **fish**: | ||
```bash | ||
echo 'githubber --completion-fish | source' >> ~/.config/fish/config.fish | ||
echo 'myprogram --completion-fish | source' >> ~/.config/fish/config.fish | ||
``` | ||
@@ -426,2 +442,38 @@ | ||
## Using with Deno | ||
Omelette now supports and is useful with **Deno**. You can make your Deno based CLI tools autocomplete powered using Omelette. It's fully featured but `setupShellInitFile` and `cleanupShellInitFile` methods does not exist for now (to prevent requirement of `allow-env`, `allow-read` and `allow-write` permissions). | ||
### Instructions to use Omelette in your Deno projects: | ||
Assume we have a `hello.js`: | ||
```typescript | ||
import omelette from "https://raw.githubusercontent.com/f/omelette/master/deno/omelette.ts"; | ||
const complete = omelette("hello <action>"); | ||
complete.on("action", function ({ reply }) { | ||
reply(["world", "mars", "jupiter"]); | ||
}); | ||
complete.init(); | ||
// your CLI program | ||
``` | ||
Install your program using `deno install`: | ||
```bash | ||
deno install hello.js | ||
hello --completion | source # bash and zsh installation | ||
hello --completion-fish | source # fish shell installation | ||
``` | ||
That's all! Now you have autocompletion feature! | ||
```bash | ||
hello <tab><tab> | ||
``` | ||
## Users? | ||
@@ -428,0 +480,0 @@ |
@@ -118,3 +118,3 @@ // Generated by CoffeeScript 2.3.2 | ||
} | ||
accessor = new Function('_', `return _['${line.split(/\s+/).slice(1, lastIndex).filter(Boolean).join("']['")}']`); | ||
accessor = t => line.split(/\s+/).slice(1, lastIndex).filter(Boolean).reduce((a, v) => a[v], t); | ||
replies = fragment === 1 ? Object.keys(objectTree) : accessor(objectTree); | ||
@@ -121,0 +121,0 @@ return reply((function(replies) { |
Uses eval
Supply chain riskPackage uses eval() which is a dangerous function. This prevents the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
486
0
25895
4