feat(dev): add Docker development CLI (#6495)

This commit is contained in:
Thomas authored and GitHub committed 2026-08-03 14:38:56 +02:00
1 parent d58a47b776
commit 018f84f80d
27 files changed
+4048 -7

No files matched your search

@@ -0,0 +1,7 @@
package platform
import "github.com/atotto/clipboard"
func CopyText(value string) error {
return clipboard.WriteAll(value)
}
@@ -0,0 +1,28 @@
package platform
import (
"fmt"
"os/exec"
"runtime"
)
func OpenURL(url string) error {
name, args, err := openCommand(runtime.GOOS, url)
if err != nil {
return err
}
return exec.Command(name, args...).Start()
}
func openCommand(goos, url string) (string, []string, error) {
switch goos {
case "darwin":
return "open", []string{url}, nil
case "linux":
return "xdg-open", []string{url}, nil
case "windows":
return "rundll32", []string{"url.dll,FileProtocolHandler", url}, nil
default:
return "", nil, fmt.Errorf("opening URLs is not supported on %s", goos)
}
}
@@ -0,0 +1,25 @@
package platform
import "testing"
func TestOpenCommand(t *testing.T) {
tests := []struct {
goos string
name string
}{
{goos: "darwin", name: "open"},
{goos: "linux", name: "xdg-open"},
{goos: "windows", name: "rundll32"},
}
for _, test := range tests {
t.Run(test.goos, func(t *testing.T) {
name, args, err := openCommand(test.goos, "https://example.com")
if err != nil {
t.Fatal(err)
}
if name != test.name || len(args) == 0 {
t.Fatalf("command = %s %v", name, args)
}
})
}
}