From 696b5c57f78390de4e90a2aa028dadb0cd2dd0d1 Mon Sep 17 00:00:00 2001 From: Justin Harms Date: Sun, 31 May 2026 17:13:34 -0500 Subject: [PATCH] Fixed invalid references to pastebin now scratchbox --- AGENTS.md | 8 ++++---- Makefile | 4 ++-- README.md | 6 +++--- cmd/{pastebin => scratchbox}/main.go | 6 +++--- cmd/{pastebin => scratchbox}/main_test.go | 0 cmd/{pastebin => scratchbox}/server.go | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) rename cmd/{pastebin => scratchbox}/main.go (81%) rename cmd/{pastebin => scratchbox}/main_test.go (100%) rename cmd/{pastebin => scratchbox}/server.go (96%) diff --git a/AGENTS.md b/AGENTS.md index 110808d..86a40aa 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -2,7 +2,7 @@ ## Purpose -This repository hosts a small self-hosted scratch service (pastebin-like) written in Go. +This repository hosts a small self-hosted scratch service written in Go. Key product constraints: - All routes are unauthenticated by design. @@ -12,7 +12,7 @@ Key product constraints: ## Project layout -- `cmd/pastebin`: service entrypoint +- `cmd/scratchbox`: service entrypoint - `internal/config`: config loading and validation - `internal/http`: HTTP handlers and middleware - `internal/storage`: filesystem storage and metadata index @@ -42,7 +42,7 @@ Use `make help` as the source of truth for available build/test targets and desc ## Cobra CLI conventions -- Keep `cmd/pastebin/main.go` focused on `main()` and root command wiring. -- Put each Cobra subcommand in its own file (for example `cmd/pastebin/server.go`). +- Keep `cmd/scratchbox/main.go` focused on `main()` and root command wiring. +- Put each Cobra subcommand in its own file (for example `cmd/scratchbox/server.go`). - Start the service through the explicit subcommand (`scratchbox server`), not from the root command directly. - Validate command arguments with Cobra arg validators (for example `cobra.NoArgs`) where applicable. diff --git a/Makefile b/Makefile index 6451e72..528ad25 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ APP_NAME := scratchbox -CMD_DIR := ./cmd/pastebin +CMD_DIR := ./cmd/scratchbox BIN_DIR := ./bin BIN := $(BIN_DIR)/$(APP_NAME) CONFIG ?= config.yaml @@ -15,7 +15,7 @@ help: @echo " make clean - Remove built artifacts" run: - go run $(CMD_DIR) --config $(CONFIG) + go run $(CMD_DIR) server --config $(CONFIG) build: mkdir -p $(BIN_DIR) diff --git a/README.md b/README.md index 28c9c88..f5d8e98 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Scratchbox Pastebin +# Scratchbox -Scratchbox is a minimal self-hosted pastebin service written in Go. It is intentionally unauthenticated and optimized for temporary sharing of text or small files with an expiration time. +Scratchbox is a minimal self-hosted scratch service written in Go. It is intentionally unauthenticated and optimized for temporary sharing of text or small files with an expiration time. Each upload creates exactly one scratch. For multi-file sharing, bundle files into an archive (for example `.zip` or `.tar.gz`) and upload that single archive file. Scratch content is stored on disk gzip-compressed transparently to reduce filesystem usage; API/UI reads return original uncompressed content. @@ -11,7 +11,7 @@ Scratch content is stored on disk gzip-compressed transparently to reduce filesy - `cp config.example.yaml config.yaml` 2. Adjust settings for your environment. 3. Start the server: - - `go run ./cmd/pastebin -config config.yaml` + - `go run ./cmd/scratchbox server -config config.yaml` 4. Open: - `http://127.0.0.1:8080/` diff --git a/cmd/pastebin/main.go b/cmd/scratchbox/main.go similarity index 81% rename from cmd/pastebin/main.go rename to cmd/scratchbox/main.go index 3f0ff5a..bac38e7 100644 --- a/cmd/pastebin/main.go +++ b/cmd/scratchbox/main.go @@ -17,9 +17,9 @@ func main() { func newRootCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "scratchbox", - Short: "Scratchbox CLI", - SilenceUsage: true, + Use: "scratchbox", + Short: "Scratchbox CLI", + SilenceUsage: true, SilenceErrors: true, RunE: func(cmd *cobra.Command, _ []string) error { return cmd.Help() diff --git a/cmd/pastebin/main_test.go b/cmd/scratchbox/main_test.go similarity index 100% rename from cmd/pastebin/main_test.go rename to cmd/scratchbox/main_test.go diff --git a/cmd/pastebin/server.go b/cmd/scratchbox/server.go similarity index 96% rename from cmd/pastebin/server.go rename to cmd/scratchbox/server.go index 8f16851..cd3c5f8 100644 --- a/cmd/pastebin/server.go +++ b/cmd/scratchbox/server.go @@ -39,7 +39,7 @@ func run(configPath string) error { return fmt.Errorf("config load failed: %w", err) } - logger := log.New(os.Stdout, "[pastebin] ", log.LstdFlags|log.LUTC) + logger := log.New(os.Stdout, "[scratchbox] ", log.LstdFlags|log.LUTC) store, err := storage.NewFilesystemStore(cfg.Storage.DataDir) if err != nil {