Skip to content

Commit

Permalink
fix for script filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhmud Ahmad committed Sep 28, 2021
1 parent d27f4f6 commit e4d0f22
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Currently supports `mysql`, `postgresql`, and `monetdb`.

## Pre-requisites

You'll need to install & use [tmux](https://github.com/tmux/tmux), which is needed to manage the split panes. It should be available from your package manager.
You'll need to install & use [tmux](https://github.com/tmux/tmux), which is needed to manage the split panes. It should be available from your package manager. Installing [jq](https://github.com/stedolan/jq) and tree would also be a good idea.

For better viewing of SQL results, the [pspg](https://github.com/okbob/pspg) pager is recommended, however, you could also use `less -SinFX`. When displaying results, qsh will try to make a sensible choice, however, you can instead explicitly choose a pager.

Expand Down Expand Up @@ -196,6 +196,13 @@ Scripts are shortcuts for SQL statements that return a consistent data set acros
tables
```

You can also apply additional filtering to scripts (you must highlight the query for this to work):

```
tables
where table_schema = 'public'
```

There are quite a few scripts available. You can see what they are by executing the `scripts` script. You can also add you own custom scripts to `~/.qsh/clients/psql/scripts` or `~/.qsh/clients/mysql/scripts`, depending on the database platform you are targeting.

For reference, here is an example of the kinds of scripts available:
Expand Down
2 changes: 1 addition & 1 deletion editors/vim/ftplugin/sql_qsh.vim
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ function QshExecuteScriptVisually() range
let script = join(s:FindVisualLines())

echo "Qsh: " . script . " >>>"
call system("$QSH scripts " . script)
call system("$QSH scripts \"" . script . "\"")
endfunction

function QshExecuteNamedScript(script)
Expand Down

0 comments on commit e4d0f22

Please sign in to comment.