Skip to content

Commit d996fa0

Browse files
docs: add MkDocs Material site (8 command categories, install/usage guides, dark theme)
Signed-off-by: night-slayer18 <samanuaia257@gmail.com>
1 parent 93afda9 commit d996fa0

14 files changed

Lines changed: 489 additions & 0 deletions

File tree

docs/assets/banner.png

390 KB
Loading

docs/commands/crypto.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Cryptography & Security
2+
3+
| Command | Description |
4+
|---------|-------------|
5+
| `hmac-sha256` | HMAC-SHA256 (requires `--key`) |
6+
| `hmac-sha512` | HMAC-SHA512 (requires `--key`) |
7+
| `aes-encrypt` | AES-256-GCM encryption (requires `--key`) |
8+
| `aes-decrypt` | AES-256-GCM decryption (requires `--key`) |
9+
| `argon2` | Argon2id password hash |
10+
| `jwt-encode` | Encode JWT (requires `--secret`) |
11+
| `jwt-decode` | Decode JWT payload |
12+
| `password-gen` | Secure random password |
13+
| `totp` | TOTP code (RFC 6238) |
14+
| `checksum-verify` | Verify checksum against hash |
15+
16+
## Examples
17+
18+
```shell
19+
echo "hello" | tweak hmac-sha256 --key "secret"
20+
echo "my text" | tweak aes-encrypt --key "mysecretpassword"
21+
tweak password-gen --length 32
22+
tweak totp JBSWY3DPEHPK3PXP
23+
```

docs/commands/encoding.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Encoding & Decoding
2+
3+
| Command | Description |
4+
|---------|-------------|
5+
| `base32-encode` / `base32-decode` | Base32 |
6+
| `base58-encode` / `base58-decode` | Base58 |
7+
| `base62-encode` / `base62-decode` | Base62 |
8+
| `base64-encode` / `base64-decode` | Base64 |
9+
| `base64url-encode` / `base64url-decode` | Base64 URL-safe |
10+
| `ascii85-encode` / `ascii85-decode` | Ascii85 |
11+
| `crockford-encode` / `crockford-decode` | Crockford Base32 |
12+
| `hex-encode` / `hex-decode` | Hexadecimal |
13+
| `binary-encode` / `binary-decode` | Binary |
14+
| `html-encode` / `html-decode` | HTML escape |
15+
| `url-encode` / `url-decode` | URL encoding |
16+
17+
## Examples
18+
19+
```shell
20+
tweak base64-encode "Hello World"
21+
echo "SGVsbG8gV29ybGQ=" | tweak base64-decode
22+
tweak hex-encode "hello"
23+
tweak url-encode "hello world & more"
24+
```

docs/commands/generators.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Generators
2+
3+
| Command | Description |
4+
|---------|-------------|
5+
| `uuid` | UUID v4 |
6+
| `ulid` | ULID (sortable unique ID) |
7+
| `nanoid` | NanoID (URL-friendly) |
8+
| `lorem` | Lorem ipsum text |
9+
| `now` | Current timestamp |
10+
| `epoch` | Unix ↔ human timestamp |
11+
| `password-gen` | Secure password |
12+
| `totp` | TOTP code (RFC 6238) |
13+
| `qrcode` | QR code in terminal |
14+
15+
## Examples
16+
17+
```shell
18+
tweak uuid
19+
tweak ulid
20+
tweak nanoid --length 10
21+
tweak lorem
22+
tweak now
23+
tweak epoch 0
24+
tweak epoch "2024-01-01"
25+
tweak qrcode "https://opensyntaxhq.github.io/tweak"
26+
```

docs/commands/hashing.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Hashing & Checksums
2+
3+
| Command | Algorithm |
4+
|---------|-----------|
5+
| `md5` | MD5 (128-bit) |
6+
| `sha1` | SHA-1 (160-bit) |
7+
| `sha224` | SHA-224 |
8+
| `sha256` | SHA-256 |
9+
| `sha384` | SHA-384 |
10+
| `sha512` | SHA-512 (512-bit) |
11+
| `bcrypt` | bcrypt |
12+
| `adler32` | Adler-32 |
13+
| `crc32` | CRC-32 (IEEE) |
14+
| `xxh32` / `xxh64` / `xxh128` | xxHash |
15+
| `blake2b` / `blake2s` | BLAKE2 |
16+
17+
## Examples
18+
19+
```shell
20+
tweak md5 "Hello World"
21+
tweak sha256 file.txt
22+
echo "hello" | tweak blake2b
23+
```

docs/commands/json.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# JSON & Data Formats
2+
3+
| Command | Description |
4+
|---------|-------------|
5+
| `json` | Format / pretty-print JSON |
6+
| `json-minify` | Minify JSON |
7+
| `json-escape` / `json-unescape` | Escape / unescape |
8+
| `json-yaml` / `yaml-json` | JSON ↔ YAML |
9+
| `json-toml` / `toml-json` | JSON ↔ TOML |
10+
| `json-xml` / `xml-json` | JSON ↔ XML |
11+
| `json-csv` / `csv-json` | JSON ↔ CSV |
12+
| `json-msgpack` / `msgpack-json` | JSON ↔ MessagePack |
13+
| `jsonl-json` | JSONL/NDJSON → JSON array |
14+
15+
## Examples
16+
17+
```shell
18+
cat config.json | tweak json
19+
cat config.yaml | tweak yaml-json
20+
curl https://api.example.com | tweak json-yaml
21+
echo '[{"id":1}' | tweak jsonl-json
22+
```

docs/commands/strings.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# String Operations
2+
3+
| Command | Description |
4+
|---------|-------------|
5+
| `lower` | to lower case |
6+
| `upper` | TO UPPER CASE |
7+
| `title` | To Title Case |
8+
| `snake` | to_snake_case |
9+
| `kebab` | to-kebab-case |
10+
| `camel` | toCamelCase |
11+
| `pascal` | ToPascalCase |
12+
| `slug` | to-slug-case |
13+
| `reverse` | esreveR |
14+
| `trim` | Trim whitespace |
15+
| `repeat` | Repeat N times |
16+
| `wrap` | Word-wrap at width |
17+
| `replace` | Find and replace |
18+
| `escape-quotes` | Escape single and double quotes |
19+
| `rot13` | ROT13 encode |
20+
| `char-freq` | Character frequency analysis |
21+
| `word-freq` | Word frequency analysis |
22+
23+
## Examples
24+
25+
```shell
26+
tweak lower "HELLO WORLD"
27+
tweak snake "Hello World"
28+
tweak camel "hello world"
29+
tweak reverse "hello"
30+
tweak wrap --width 40 "a long sentence that needs wrapping"
31+
```

docs/commands/text.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Text Processing
2+
3+
| Command | Description |
4+
|---------|-------------|
5+
| `grep` | Filter lines by regex |
6+
| `column` | Extract field by position |
7+
| `pad-left` / `pad-right` | Pad string to width |
8+
| `regex-match` | Extract regex matches |
9+
| `regex-replace` | Replace by regex |
10+
| `remove-spaces` | Remove all spaces |
11+
| `remove-newlines` | Remove all newlines |
12+
| `count-words` | Word count |
13+
| `count-chars` | Character count |
14+
| `sort-lines` | Sort alphabetically |
15+
| `reverse-lines` | Reverse line order |
16+
| `shuffle-lines` | Shuffle randomly |
17+
| `unique-lines` | Remove duplicates |
18+
| `count-lines` | Line count |
19+
| `number-lines` | Prepend line numbers |
20+
| `morse-encode` / `morse-decode` | Morse code |
21+
| `caesar-encode` / `caesar-decode` | Caesar cipher |
22+
| `markdown-html` | Markdown → HTML |
23+
| `base-convert` | Arbitrary base conversion |
24+
| `zeropad` | Zero-pad a number |
25+
26+
## Examples
27+
28+
```shell
29+
cat file.txt | tweak grep --pattern "^error"
30+
echo "one two three" | tweak column --field 2
31+
echo "5" | tweak pad-left --width 4 --char 0
32+
echo "hello" | tweak regex-replace --pattern "l+" --replace "L"
33+
echo "SOS" | tweak morse-encode
34+
tweak zeropad --n 6 "42"
35+
```

docs/commands/validation.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Validation & Detection
2+
3+
| Command | Description |
4+
|---------|-------------|
5+
| `validate-json` | Validate JSON |
6+
| `validate-email` | Validate email address |
7+
| `validate-url` | Validate URL |
8+
| `detect` | Auto-detect encoding and decode |
9+
| `extract-emails` | Extract all emails from text |
10+
| `extract-urls` | Extract all URLs from text |
11+
| `extract-ips` | Extract all IP addresses from text |
12+
13+
## Examples
14+
15+
```shell
16+
echo '{"key":"value"}' | tweak validate-json
17+
echo "user@example.com" | tweak validate-email
18+
echo "not-an-email" | tweak validate-email
19+
echo "SGVsbG8=" | tweak detect
20+
cat log.txt | tweak extract-emails
21+
cat page.html | tweak extract-urls
22+
cat access.log | tweak extract-ips
23+
```

docs/contributing.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Contributing to Tweak
2+
3+
Thank you for your interest!
4+
5+
## Development Setup
6+
7+
```bash
8+
git clone https://github.com/OpenSyntaxHQ/tweak.git
9+
cd tweak
10+
go mod tidy
11+
go generate ./...
12+
go build ./...
13+
go test ./tests/...
14+
```
15+
16+
## Adding a New Processor
17+
18+
1. Create a file in `processors/` implementing the `Processor` interface:
19+
20+
```go
21+
type MyProcessor struct{}
22+
23+
func (p MyProcessor) Name() string { return "my-proc" }
24+
func (p MyProcessor) Alias() []string { return nil }
25+
func (p MyProcessor) Title() string { return fmt.Sprintf("My Processor (%s)", p.Name()) }
26+
func (p MyProcessor) Description() string { return "Short description" }
27+
func (p MyProcessor) FilterValue() string { return p.Title() }
28+
func (p MyProcessor) Flags() []Flag { return nil }
29+
func (p MyProcessor) Transform(data []byte, f ...Flag) (string, error) {
30+
// implementation
31+
}
32+
```
33+
34+
2. Register it in `processors/all.go`.
35+
36+
3. Add a test in `tests/` — see existing files for patterns.
37+
38+
## Commit Guidelines
39+
40+
- Use [Conventional Commits](https://www.conventionalcommits.org/)
41+
- Sign off every commit: `git commit -s`
42+
- Keep commits small and focused
43+
44+
## Running Tests
45+
46+
```bash
47+
go test -v -race -count=1 ./tests/...
48+
```
49+
50+
## License
51+
52+
By contributing, you agree your contributions will be licensed under the Apache 2.0 License.

0 commit comments

Comments
 (0)