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
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ jobs:
- run: git fetch --force --tags
- uses: actions/setup-go@v5
with:
go-version: 1.23
go-version: 1.24
- run: sudo apt-get install libx11-dev
- uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.23
go-version: 1.24
- run: sudo apt-get install libx11-dev
- uses: Homebrew/actions/setup-homebrew@master
- run: brew install notnmeyer/tsk/tsk
- run: tsk test
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ brew install daylog

Or grab a release directly from the [releases page]()

### Install from source
### From source

1. Build the project with, `go build -o ~/bin/daylog main.go`, substituting `~/bin/daylog` for a different path if you prefer.

Expand All @@ -40,3 +40,5 @@ Or grab a release directly from the [releases page]()
DayyyyyyyyyyLLooooooooog!

![image](https://github.com/notnmeyer/daylog-cli/assets/672246/949b7eee-aa63-484a-a366-231462ac9563)

If you're building on Linux, you may need to install X11 headers. Depending on your distro that could be `libx11-dev` (Debian/Ubuntu), `libx11-devel` (Fedora/RHEL/CentOS), or `libx11` (arch).
47 changes: 47 additions & 0 deletions cmd/copy.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package cmd

import (
"fmt"
"log"

"github.com/notnmeyer/daylog-cli/internal/daylog"
"github.com/spf13/cobra"
"golang.design/x/clipboard"
)

var copyCmd = &cobra.Command{
Use: "copy",
Short: "Copy the specified log to the clipboard",
Long: "Copy the specified log to the clipboard",
Run: func(cmd *cobra.Command, args []string) {
dl, err := daylog.New(args, config.Project)
if err != nil {
log.Fatal(err)
}

logContents, err := dl.Show("text")
if err != nil {
log.Fatalf("%s", err.Error())
}

err = copy([]byte(logContents))
if err != nil {
log.Fatalf("Failed to copy to clipboard: %v", err)
}

fmt.Println("Copied to clipboard.")
},
}

func copy(content []byte) error {
err := clipboard.Init()
if err != nil {
return err
}
clipboard.Write(clipboard.FmtText, content)
return nil
}

func init() {
rootCmd.AddCommand(copyCmd)
}
9 changes: 7 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
module github.com/notnmeyer/daylog-cli

go 1.21
go 1.23.0

toolchain go1.24.3

require (
github.com/adrg/xdg v0.4.0
github.com/arl/dirtree v0.1.3
github.com/charmbracelet/glamour v0.6.0
github.com/markusmobius/go-dateparser v1.2.3
github.com/spf13/cobra v1.8.0
golang.design/x/clipboard v0.7.0
)

require (
Expand Down Expand Up @@ -36,6 +38,9 @@ require (
github.com/yuin/goldmark v1.5.2 // indirect
github.com/yuin/goldmark-emoji v1.0.1 // indirect
golang.org/x/exp v0.0.0-20220321173239-a90fa8a75705 // indirect
golang.org/x/exp/shiny v0.0.0-20250606033433-dcc06ee1d476 // indirect
golang.org/x/image v0.14.0 // indirect
golang.org/x/mobile v0.0.0-20231127183840-76ac6878050a // indirect
golang.org/x/net v0.22.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
Expand Down
10 changes: 8 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ github.com/adrg/xdg v0.4.0 h1:RzRqFcjH4nE5C6oTAxhBtoE2IRyjBSa62SCbyPidvls=
github.com/adrg/xdg v0.4.0/go.mod h1:N6ag73EX4wyxeaoeHctc1mas01KZgsj5tYiAIwqJE/E=
github.com/alecthomas/chroma v0.10.0 h1:7XDcGkCQopCNKjZHfYrNLraA+M7e0fMiJ/Mfikbfjek=
github.com/alecthomas/chroma v0.10.0/go.mod h1:jtJATyUxlIORhUOFNA9NZDWGAQ8wpxQQqNSB4rjA/1s=
github.com/arl/dirtree v0.1.3 h1:Q1ldIP0t4CQH3vUujlSgHEKwa6TqloXuxLNQRJHpl5w=
github.com/arl/dirtree v0.1.3/go.mod h1:uVPZKJm2M2hHWWUw+47yimVo48wNHtXEs19wwQOmy/U=
github.com/aymanbagabas/go-osc52 v1.0.3 h1:DTwqENW7X9arYimJrPeGZcV0ln14sGMt3pHZspWD+Mg=
github.com/aymanbagabas/go-osc52 v1.0.3/go.mod h1:zT8H+Rk4VSabYN90pWyugflM3ZhpTZNC7cASDfUCdT4=
github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk=
Expand Down Expand Up @@ -74,8 +72,16 @@ github.com/yuin/goldmark v1.5.2 h1:ALmeCk/px5FSm1MAcFBAsVKZjDuMVj8Tm7FFIlMJnqU=
github.com/yuin/goldmark v1.5.2/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/yuin/goldmark-emoji v1.0.1 h1:ctuWEyzGBwiucEqxzwe0SOYDXPAucOrE9NQC18Wa1os=
github.com/yuin/goldmark-emoji v1.0.1/go.mod h1:2w1E6FEWLcDQkoTE+7HU6QF1F6SLlNGjRIBbIZQFqkQ=
golang.design/x/clipboard v0.7.0 h1:4Je8M/ys9AJumVnl8m+rZnIvstSnYj1fvzqYrU3TXvo=
golang.design/x/clipboard v0.7.0/go.mod h1:PQIvqYO9GP29yINEfsEn5zSQKAz3UgXmZKzDA6dnq2E=
golang.org/x/exp v0.0.0-20220321173239-a90fa8a75705 h1:ba9YlqfDGTTQ5aZ2fwOoQ1hf32QySyQkR6ODGDzHlnE=
golang.org/x/exp v0.0.0-20220321173239-a90fa8a75705/go.mod h1:lgLbSvA5ygNOMpwM/9anMpWVlVJ7Z+cHWq/eFuinpGE=
golang.org/x/exp/shiny v0.0.0-20250606033433-dcc06ee1d476 h1:Wdx0vgH5Wgsw+lF//LJKmWOJBLWX6nprsMqnf99rYDE=
golang.org/x/exp/shiny v0.0.0-20250606033433-dcc06ee1d476/go.mod h1:ygj7T6vSGhhm/9yTpOQQNvuAUFziTH7RUiH74EoE2C8=
golang.org/x/image v0.14.0 h1:tNgSxAFe3jC4uYqvZdTr84SZoM1KfwdC9SKIFrLjFn4=
golang.org/x/image v0.14.0/go.mod h1:HUYqC05R2ZcZ3ejNQsIHQDQiwWM4JBqmm6MKANTp4LE=
golang.org/x/mobile v0.0.0-20231127183840-76ac6878050a h1:sYbmY3FwUWCBTodZL1S3JUuOvaW6kM2o+clDzzDNBWg=
golang.org/x/mobile v0.0.0-20231127183840-76ac6878050a/go.mod h1:Ede7gF0KGoHlj822RtphAHK1jLdrcuRBZg0sF1Q+SPc=
golang.org/x/net v0.0.0-20221002022538-bcab6841153b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc=
golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
Expand Down
5 changes: 4 additions & 1 deletion shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
pkgs.mkShell {
packages = with pkgs; [
delve
go_1_23
go_1_24
gopls
goreleaser
];

shellHook = ''
go install github.com/spf13/cobra-cli@latest
'';

nativeBuildInputs = [ pkgs.gcc pkgs.pkg-config ];
buildInputs = pkgs.lib.optionals pkgs.stdenv.isLinux [ pkgs.xorg.libX11 ];
}
28 changes: 9 additions & 19 deletions tasks.toml
Original file line number Diff line number Diff line change
@@ -1,30 +1,20 @@
[tasks.deps]
cmds = [
"go mod tidy"
]
cmds = ["go mod tidy"]

[tasks.build]
cmds = [
"go build -o dist/daylog ./main.go {{.CLI_ARGS}}"
]
cmds = ["go build -o dist/daylog ./main.go {{.CLI_ARGS}}"]

[tasks."build:demo"]
cmds = [
"nix-shell -p ffmpeg ttyd vhs --run \"vhs demo/demo.tape\"",
]
cmds = ["nix-shell -p ffmpeg ttyd vhs --run \"vhs demo/demo.tape\""]

[tasks.run]
cmds = [
"go run main.go {{.CLI_ARGS}}"
]
cmds = ["go run main.go {{.CLI_ARGS}}"]

[tasks.test]
cmds = [
"go test ./... -race"
]
cmds = ["go test ./... -race"]

[tasks.release]
cmds = [
"git tag {{.CLI_ARGS}}",
"git push origin --tags",
]
cmds = ["git tag {{.CLI_ARGS}}", "git push origin --tags"]

[tasks."new:command"]
cmds = ["cobra-cli add {{.CLI_ARGS}}"]