Skip to content

Commit

Permalink
feat(clipboard): remove copy as output source
Browse files Browse the repository at this point in the history
  • Loading branch information
bashbunni committed Dec 5, 2024
1 parent 6d74d8c commit 87af18f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ Copy the output image to your clipboard, so you can paste it anywhere.

```bash
freeze main.go --output clipboard
freeze main.go --output copy
```

### Font
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ func main() {
istty := isatty.IsTerminal(os.Stdout.Fd())

outputName := config.Output
if config.Output == "clipboard" || config.Output == "copy" {
if config.Output == "clipboard" {
outputName = "clipboard.png"
}
switch {
Expand Down
9 changes: 3 additions & 6 deletions png.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func libsvgConvert(doc *etree.Document, _, _ float64, output string) error {
if err != nil {
return err
}
err = copyToClipboard(png)
return copyToClipboard(png)
}
return err //nolint: wrapcheck
}
Expand Down Expand Up @@ -114,10 +114,7 @@ func resvgConvert(doc *etree.Document, w, h float64, output string) error {
}

if output == "clipboard" {
err = copyToClipboard(png)
} else {
err = os.WriteFile(output, png, 0o600)
return copyToClipboard(png)
}

return err //nolint: wrapcheck
return os.WriteFile(output, png, 0o600)

Check failure on line 119 in png.go

View workflow job for this annotation

GitHub Actions / lint-soft

error returned from external package is unwrapped: sig: func os.WriteFile(name string, data []byte, perm io/fs.FileMode) error (wrapcheck)
}

0 comments on commit 87af18f

Please sign in to comment.