diff --git a/cmd/main.go b/cmd/main.go index 5a56137..184c656 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -21,14 +21,6 @@ func main() { os.Exit(1) } - // 获取API密钥 - // apiKey := getAPIKey() - // if apiKey == "" { - // fmt.Println("错误: 未设置API密钥") - // fmt.Println("请设置环境变量 SILICON_API_KEY 或在配置文件中指定") - // os.Exit(1) - // } - // 创建AI客户端 client := ai.NewClient(config.API) diff --git a/internal/clipboard/clipboard.go b/internal/clipboard/clipboard.go index 3a91ebe..3e628ad 100644 --- a/internal/clipboard/clipboard.go +++ b/internal/clipboard/clipboard.go @@ -1,39 +1,10 @@ package clipboard import ( - "fmt" - "runtime" - "github.com/atotto/clipboard" ) -var isClipboardAvailable bool - -func init() { - // 检测剪切板是否可用 - // Linux需要xclip或xsel - if runtime.GOOS == "linux" { - isClipboardAvailable = isXClipAvailable() - } else { - isClipboardAvailable = true - } -} - -func isXClipAvailable() bool { - // 简单检查,实际使用时会在调用时检测 - return true -} - // Write 将文本复制到剪切板 func Write(text string) error { - if !isClipboardAvailable { - return fmt.Errorf("clipboard not available on this system") - } return clipboard.WriteAll(text) } - -// WriteSilent 静默复制到剪切板,不返回错误 -func WriteSilent(text string) bool { - err := Write(text) - return err == nil -} diff --git a/internal/clipboard/clipboard_test.go b/internal/clipboard/clipboard_test.go new file mode 100644 index 0000000..f2e0c2e --- /dev/null +++ b/internal/clipboard/clipboard_test.go @@ -0,0 +1,9 @@ +package clipboard + +import ( + "testing" +) + +func TestWrite(t *testing.T) { + Write("你好鸭") +}