Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions cmd/clippy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"io"
"os"
"path/filepath"
"runtime"
"strings"
"time"

Expand Down Expand Up @@ -38,6 +39,13 @@ var (
)

func main() {
// Clippy only works on macOS
if runtime.GOOS != "darwin" {
fmt.Fprintf(os.Stderr, "Error: Clippy only works on macOS (detected: %s)\n", runtime.GOOS)
fmt.Fprintln(os.Stderr, "Clippy uses macOS-specific clipboard APIs and frameworks.")
os.Exit(1)
}

// Preprocess args to convert "-r 3" to "-r=3" for Cobra compatibility
os.Args = preprocessArgs(os.Args)

Expand Down
6 changes: 6 additions & 0 deletions cmd/clippy/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@ import (
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
"testing"
)

func TestMain(m *testing.M) {
// Clippy only works on macOS
if runtime.GOOS != "darwin" {
panic("Clippy tests require macOS (detected: " + runtime.GOOS + ")")
}

// Build the binary for testing
cmd := exec.Command("go", "build", "-o", "clippy_test", ".")
if err := cmd.Run(); err != nil {
Expand Down
8 changes: 8 additions & 0 deletions cmd/pasty/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"os"
"path/filepath"
"runtime"

"github.com/neilberkman/clippy"
"github.com/neilberkman/clippy/cmd/internal/common"
Expand All @@ -24,6 +25,13 @@ var (
)

func main() {
// Pasty only works on macOS
if runtime.GOOS != "darwin" {
fmt.Fprintf(os.Stderr, "Error: Pasty only works on macOS (detected: %s)\n", runtime.GOOS)
fmt.Fprintln(os.Stderr, "Pasty uses macOS-specific clipboard APIs and frameworks.")
os.Exit(1)
}

var rootCmd = &cobra.Command{
Use: "pasty [destination]",
Short: "Smart paste tool for macOS",
Expand Down