You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: pre-filter Desktop Logs view by Compose project
Pass the active project name as the appId query parameter on the
docker-desktop://dashboard/logs deep link, both from the post-command
hint (compose up -d, compose logs) and the interactive nav menu
('l' key during compose up). The hook subprocess re-runs compose-go's
project loader so the name matches what the parent computed; it skips
the appId when -p, -f, --project-directory, --workdir, or --env-file
is set, since the hook payload does not carry their values. docker
logs stays unfiltered: the CLI hook contract does not expose the
positional container id.
Signed-off-by: Guillaume Lours <glours@users.noreply.github.com>
Copy file name to clipboardExpand all lines: cmd/compose/hooks.go
+84-26Lines changed: 84 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,9 @@ import (
21
21
"encoding/json"
22
22
"io"
23
23
"os"
24
+
"time"
24
25
26
+
"github.com/compose-spec/compose-go/v2/cli"
25
27
"github.com/docker/cli/cli-plugins/hooks"
26
28
"github.com/docker/cli/cli-plugins/metadata"
27
29
"github.com/spf13/cobra"
@@ -30,14 +32,12 @@ import (
30
32
"github.com/docker/compose/v5/internal/desktop"
31
33
)
32
34
33
-
constdeepLink="docker-desktop://dashboard/logs"
34
-
35
-
funccomposeLogsHint() string {
36
-
return"Filter, search, and stream logs from all your Compose services\nin one place with Docker Desktop's Logs view. "+hintLink(deepLink)
35
+
funccomposeLogsHint(appIDstring) string {
36
+
return"Filter, search, and stream logs from all your Compose services\nin one place with Docker Desktop's Logs view. "+hintLink(desktop.BuildLogsURL(appID))
37
37
}
38
38
39
-
funcdockerLogsHint() string {
40
-
return"View and search logs for all containers in one place\nwith Docker Desktop's Logs view. "+hintLink(deepLink)
39
+
funcdockerLogsHint(appIDstring) string {
40
+
return"View and search logs for all containers in one place\nwith Docker Desktop's Logs view. "+hintLink(desktop.BuildLogsURL(appID))
41
41
}
42
42
43
43
// hintLink returns a clickable OSC 8 terminal hyperlink when ANSI is allowed,
0 commit comments