Metadata-Version: 2.4
Name: rembook
Version: 0.1.0
Summary: A simple CLI tool for bookmarking SSH connections from your bash history
Author-email: Kirill Nikolsky <glucksistemi@gmail.com>
Maintainer-email: Kirill Nikolsky <glucksistemi@gmail.com>
License: BSD-3-Clause
Project-URL: Homepage, https://github.com/Glucksistemi/rembook
Project-URL: Repository, https://github.com/Glucksistemi/rembook
Project-URL: Issues, https://github.com/Glucksistemi/rembook/issues
Keywords: ssh,bookmark,cli,terminal,bash-history
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: MacOS
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: System :: Systems Administration
Classifier: Topic :: Utilities
Classifier: Environment :: Console
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: typer>=0.20.0
Requires-Dist: tabulate>=0.9.0
Requires-Dist: appdirs>=1.4.4
Dynamic: license-file

# rembook

**rembook** is a simple CLI tool that helps you bookmark and manage SSH connections from your bash history. Stop scrolling through `.bash_history` to find that one server you accessed last week!

## Features

- 📚 **Automatic History Parsing**: Scans your `.bash_history` for SSH connections
- 🔖 **Bookmark Management**: Save frequently used SSH commands with memorable names
- 🎯 **Quick Access**: Launch saved connections with a single command
- 📊 **Interactive Selection**: Browse available connections in a neat table
- 🔢 **Smart Sorting**: Shows most frequently used connections first

## Installation

### From PyPI

```bash
pip install rembook
```

### From Source

```bash
git clone git@github.com:Glucksistemi/rembook.git
cd rembook
pip install -e .
```

## Usage

### Basic Usage

Simply run `rembook` to see an interactive list of all available SSH connections:

```bash
rembook
```

This will display a table with:
- All your bookmarked connections
- SSH commands from your bash history (sorted by frequency)

Select a connection by entering its number, or type a new SSH command directly.

### Launch a Saved Bookmark

```bash
rembook myserver
```

This will execute the SSH command associated with the bookmark `myserver`.

### Create a Bookmark

Add a bookmark interactively:

```bash
rembook -a
```

You'll be prompted to select a connection and give it a name.

Or create a bookmark directly:

```bash
rembook mybookmark -a
```

This will prompt you to select a connection to save as `mybookmark`.

### Delete a Bookmark

```bash
rembook mybookmark -d
```

Or delete interactively:

```bash
rembook -d
```

## Examples

### Example 1: Browse and connect

```bash
$ rembook
No  Connection              Bookmark
--  ----------------------  ----------
1   ssh user@server1.com    prod
2   ssh admin@192.168.1.1   router
3   ssh dev@staging.com

Enter number of connection or ssh command [1]: 1
# Connects to server1.com
```

### Example 2: Save a bookmark

```bash
$ rembook production -a
No  Connection              Bookmark
--  ----------------------  ----------
1   ssh user@prod.app.com
2   ssh admin@192.168.1.1   router

Enter number of connection or ssh command [1]: 1
# Saves ssh user@prod.app.com as "production"
```

### Example 3: Use a saved bookmark

```bash
$ rembook production
# Immediately connects to ssh user@prod.app.com
```

### Example 4: Quick SSH with custom command

```bash
$ rembook
No  Connection              Bookmark
--  ----------------------  ----------
1   ssh user@server1.com    prod

Enter number of connection or ssh command [1]: user@newserver.com
# Connects to ssh user@newserver.com
```

## How It Works

1. **History Parsing**: rembook scans your `~/.bash_history` file for SSH commands
2. **Frequency Analysis**: Commands are ranked by how often you've used them
3. **Persistent Bookmarks**: Saved bookmarks are stored in your user config directory
4. **Quick Execution**: Selected commands are executed directly via `os.system()`

## Requirements

- Python 3.10+
- Bash shell (uses `.bash_history`)
- Linux or macOS

## Dependencies

- [typer](https://typer.tiangolo.com/) - CLI framework
- [tabulate](https://github.com/astanin/python-tabulate) - Table formatting
- [appdirs](https://github.com/ActiveState/appdirs) - Cross-platform config directory

## Configuration

Bookmarks are stored in a JSON file at:
- **Linux**: `~/.config/rembook/bookmarks.json`
- **macOS**: `~/Library/Application Support/rembook/bookmarks.json`

## License

BSD 3-Clause License. See LICENSE file for details.

## Author

**Kirill Nikolsky** - [glucksistemi@gmail.com](mailto:glucksistemi@gmail.com)

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

## Repository

<https://github.com/Glucksistemi/rembook>
