Files
spellbook/README.md
T
abelith a8f164c241 feat
- configuration
2026-08-08 17:40:47 +05:00

109 lines
2.3 KiB
Markdown

# spellbook 0.1.0-alpha
`spellbook` is a lightweight CLI command manager written in Go. It allows you to save complex shell commands as parameterized templates ("spells") and execute them instantly with custom arguments.
---
## Table of contents
- [Features](#features)
- [Building from Source](#building-from-source)
- [Configuration](#configuration)
- [Usage](#usage)
- [Upcoming Features](#upcoming-features)
---
## Features
- **Pure Go & CGO-Free:** Built with SQLite (`modernc.org/sqlite`), resulting in a single portable binary without external dependencies.
- **Templating:** Define dynamic parameters inside commands using `{{ .variable }}` syntax.
- **Tags & Descriptions:** Organize and document your command collection.
---
## Building from Source
### Prerequisites
* [Go](https://go.dev/) 1.22 or higher
### Build Steps
```shell
# Clone the repository
git clone https://github.com/abelith/spellbook.git
cd spellbook
# Build static binary
CGO_ENABLED=0 go build -o spellbook .
# Move to bin directory (for Linux/macOS)
mv spellbook $(go env GOPATH)/bin/
```
---
## Configuration
### Env
- `SPELLBOOK_DB_PATH`: db location (example: `/spellbook/spellbook.db`)
---
## Usage
- Use `spellbook help` to list commands
- Use `spellbook [command] --help` to get info on specific command
### List spells
Use `spellbook` to list prepared spells
### Add new spell
Use `spellbook add -n name -t tags -d desc -- command` to add a new spell
- `-n` or `--name` is a name of a spell
- `-t` or `--tags` is a comma-separated list of spell tags
- `-d` or `--desc` is a short description of spell
- `command` is an actual spell template
### Remove a spell
Use `spellbook rm [spell_name]` to remove a spell
- `spell_name` is a name of a spell
### Casting a spell
Use `spellbook [spell_name] key=val` to cast a spell
- `spell_name` is a name of a spell
- `key=val` are key/value arguments
### Examples
Said, you have added a spell like this
```shell
spellbook add -n my-spell -t net,http -d my-desc -- curl 127.0.0.1
```
To use it, run this command
```shell
spellbook my-spell
```
Or you may want to use dynamic parameters like this
```shell
spellbook add -n my-spell -t net,http -d my-desc -- curl {{.target}}
```
And cast the spell like this
```shell
spellbook my-spell target=127.0.0.1
```
---
## Upcoming Features
- Search to navigate your spell book