PassAGE/main.go
fraggle 3552db50c2 Initial commit: PassAGE password manager
- AGE encryption with master password model
- Core commands: init, show, insert, edit, generate, rm, mv, cp, find, grep, ls
- Git integration for version control
- Clipboard support (X11 and Wayland)
- Secure password generation
- Backup and restore functionality
- Comprehensive security features
- Complete documentation
2026-01-11 18:48:01 -04:00

98 lines
2.9 KiB
Go

package main
import (
"fmt"
"os"
)
const version = "0.1.0"
const usage = `PassAGE - A modern password manager using AGE encryption
Usage:
passage init [--path=subfolder]
Initialize new password storage with a master password.
Prompts for master password (used to encrypt/decrypt all passwords).
passage [ls] [subfolder]
List passwords.
passage find pass-names...
List passwords that match pass-names.
passage [show] [--clip[=line-number]] pass-name
Show existing password and optionally put it on the clipboard.
passage grep [GREPOPTIONS] search-string
Search for password files containing search-string when decrypted.
passage insert [--multiline] [--force] pass-name
Insert new password. Optionally, the entry may be multiline.
passage edit pass-name
Insert a new password or edit an existing password using ${EDITOR:-vi}.
passage generate [--no-symbols] [--clip] [--in-place | --force] pass-name [pass-length]
Generate a new password of pass-length (or 25 if unspecified).
passage rm [--recursive] [--force] pass-name
Remove existing password or directory, optionally forcefully.
passage mv [--force] old-path new-path
Renames or moves old-path to new-path, optionally forcefully.
passage cp [--force] old-path new-path
Copies old-path to new-path, optionally forcefully.
passage backup [--output=file.tar.gz]
Create a backup of the password store with integrity verification.
passage restore [--force] [--skip-verify] backup-file.tar.gz
Restore a backup of the password store with integrity verification.
passage git git-command-args...
If the password store is a git repository, execute a git command.
passage help
Show this text.
passage version
Show version information.
Environment variables:
PASSAGE_DIR Path to the password store (default: ~/.passage-store)
PASSAGE_CLIP_TIME Time in seconds to keep password in clipboard (default: 10)
PASSAGE_GENERATED_LENGTH Default length for generated passwords (default: 25)
`
func main() {
if len(os.Args) < 2 {
cmdShow([]string{})
return
}
command := os.Args[1]
args := os.Args[2:]
switch command {
case "init":
cmdInit(args)
case "help", "--help", "-h":
fmt.Print(usage)
case "version", "--version", "-v":
fmt.Printf("PassAGE version %s\n", version)
case "show", "ls", "list":
cmdShow(args)
case "find", "search":
cmdFind(args)
case "grep":
cmdGrep(args)
case "insert", "add":
cmdInsert(args)
case "edit":
cmdEdit(args)
case "generate":
cmdGenerate(args)
case "delete", "rm", "remove":
cmdDelete(args)
case "rename", "mv":
cmdMove(args)
case "copy", "cp":
cmdCopy(args)
case "backup":
cmdBackup(args)
case "restore":
cmdRestore(args)
case "git":
cmdGit(args)
default:
// Try as show command
cmdShow(os.Args[1:])
}
}