Skip to content

Commit

Permalink
readme: add demo
Browse files Browse the repository at this point in the history
  • Loading branch information
evanbattaglia committed Oct 11, 2024
1 parent 1bb2a7c commit 58bf619
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Tabry (Rust edition)
Tabry is a program and mini-language that allows you to easily create tab completion for 3rd-party programs or your own scripts. Here is an example for [pass](https://www.passwordstore.org/):
Tabry is a program and mini-language that allows you to easily create shell tab completion for 3rd-party programs or your own scripts. Here is an example for [pass](https://www.passwordstore.org/):

```
cmd pass
Expand All @@ -20,6 +20,31 @@ Tabry targets "git-style" CLIs with subcommands, flags, and arguments. Flags can

Please see the [documentation in the Ruby project](https://github.com/evanbattaglia/tabry/blob/master/LANGUAGE_REFERENCE.md) for full language documentation.

# Demo

Let's say you have a script `openfile` that opens files in ~/bin or config files in ~/.config/:

```
[[ "$1" == "config" ]] && vi ~/.config/"$2"
[[ "$1" == "bin" ]] && vi ~/bin/"$2"
```

Putting the following file in ~/.local/share/tabry/openfile.tabry and running `source <(tabry bash)` or `tabry fish | source` will give you completions for the two commands "config" and "bin" and argument completions for the files in those directories.

```
sub config "open config file from ~/.config/*" {
arg { opts shell "cd ~/.config/ && ls" }
}
sub bin "open a file in ~/bin directory" {
arg { opts shell "cd ~/bin && ls" }
}
```

Demo gif:
![Demo gif](./doc/demo.gif)

The shell command in `opts shell` can of course be much more complicated things including piplines and text manipulation, it just needs to return a newline-separated list of options.

# Installation

## Installing the binary
Expand Down
Binary file added doc/demo.gif
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 58bf619

Please sign in to comment.