Skip to content

Commit b98f1ff

Browse files
oaldersclaude
andcommitted
Add XDG_CONFIG_DIRS and XDG_DATA_DIRS to split environment variables
These XDG variables contain colon-separated paths similar to PATH and MANPATH. Split them on ':' and display each path on a separate line for better readability in table output. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 600e5b0 commit b98f1ff

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

known.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@ import (
2525
)
2626

2727
const (
28-
manpath = "MANPATH"
29-
path = "PATH"
30-
trueStr = "true"
31-
falseStr = "false"
28+
manpath = "MANPATH"
29+
path = "PATH"
30+
xdgConfigDirs = "XDG_CONFIG_DIRS"
31+
xdgDataDirs = "XDG_DATA_DIRS"
32+
trueStr = "true"
33+
falseStr = "false"
3234
)
3335

3436
// Run "is known ...".
@@ -325,7 +327,7 @@ func envSummary(ctx *types.Context, asJSON bool, asMarkdown bool) error {
325327

326328
name, value := parts[0], parts[1]
327329

328-
if name == path || name == manpath {
330+
if name == path || name == manpath || name == xdgConfigDirs || name == xdgDataDirs {
329331
pathParts := strings.Split(value, ":")
330332
if asJSON {
331333
envMap[name] = pathParts
@@ -369,7 +371,7 @@ func getEnv(ctx *types.Context, name string, asJSON bool) (string, error) {
369371
values := []string{}
370372

371373
switch {
372-
case set && (name == path || name == manpath):
374+
case set && (name == path || name == manpath || name == xdgConfigDirs || name == xdgDataDirs):
373375
values = strings.Split(value, ":")
374376
case set:
375377
values = append(values, value)

0 commit comments

Comments
 (0)