2020 day 3 - simple 2d grid traversal

This commit is contained in:
alexchao26
2020-12-03 00:28:22 -05:00
parent 79925f6507
commit ce80ce9f81
5 changed files with 448 additions and 9 deletions
+24
View File
@@ -0,0 +1,24 @@
package util
import (
"bytes"
"fmt"
"os/exec"
)
// CopyToClipboard is for macOS
func CopyToClipboard(text string) error {
command := exec.Command("pbcopy")
command.Stdin = bytes.NewReader([]byte(text))
if err := command.Start(); err != nil {
return fmt.Errorf("error starting pbcopy command: %w", err)
}
err := command.Wait()
if err != nil {
return fmt.Errorf("error running pbcopy %w", err)
}
return nil
}