diff --git a/README.md b/README.md new file mode 100644 index 0000000..fe1fb8b --- /dev/null +++ b/README.md @@ -0,0 +1,83 @@ +# sshmngrs + +A fast and simple SSH connection manager in a terminal UI, built in Rust and +[ratatui](https://ratatui.rs). + +## Features + +- Terminal UI to browse your saved connections +- Each connection has an **alias** and the **command** to run (for example + `ssh root@192.168.100.1`) +- Launch a connection: the TUI suspends, the command runs with full access to + the terminal (password prompts, host-key confirmations, etc.), and the TUI is + restored afterwards +- Vim-style navigation (`j` / `k`) alongside the arrow keys +- Connections are stored as TOML in a config file located in $HOME/.config/sshmngrs.conf + +## Installation + +Requires a recent Rust toolchain and the `ssh` client available on your `PATH`. + +```bash +# Run from source +cargo run --release + +# Or install the binary +cargo install --path . + +# Or from crates.io +cargo install sshmngrs +``` + +## Usage + +Launch the app: + +```Bash +sshmngrs +``` + +### Keybindings + +| Key | Action | +| ---------------------- | ------------------------------- | +| `Enter` | Connect to the selected command | +| `a` | Add a new command | +| `e` | Edit the selected command | +| `d` | Delete the selected command | +| `↑` / `k` | Move selection up | +| `↓` / `j` | Move selection down | +| `q` / `Esc` / `Ctrl+C` | Quit | + +## Configuration + +Connections are stored as TOML at `~/.config/sshmngrs.conf`. +This is an example: + +```toml +[[commands]] +alias = "kirbylife-lab (Podman)" +command = "ssh noroot@localhost:123" + +[[commands]] +alias = "kirbylife-router" +command = "ssh root@192.168.100.1" +``` + +The `command` can be any shell command, so anything you would type in your shell works: +- Extra `ssh` flags +- Custom `ssh` paths +- `scp` +- Jump shosts +- Aliases from your `~/.ssh/config` +- Etc... + +## Importing from sshch + +If you come from [sshch](https://gitlab.com/zlax/sshch), the INI config at +`~/.config/sshch.conf` can be converted to the sshmngrs format with this +one-liner. Each `exec_string` becomes a command; groups and stored passwords are ignored. + +```bash +awk 'function esc(s){gsub(/\\/,"\\\\",s);gsub(/"/,"\\\"",s);return s} /^\[/{gsub(/^\[|\]$/,"");a=$0;next} /^exec_string[ \t]*=/{sub(/^exec_string[ \t]*=[ \t]*/,"");printf "[[commands]]\nalias = \"%s\"\ncommand = \"%s\"\n\n",esc(a),esc($0)}' ~/.config/sshch.conf > ~/.config/sshmngrs.conf +```