Skip to content

Commit 116f962

Browse files
authored
feat(resolve): add verbosity support to pixi operations (#197)
Introduce verbosity flags to pixi init, update, and install commands in the resolve function. This allows controlling output verbosity based on user preferences, with conditional logging of pixi.toml content when verbosity is non-negative. The _verbosity_flags function now accepts an optional verbosity level parameter. Co-authored-by: Christopher Doris <github.com/cjdoris>
1 parent d1f6765 commit 116f962

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/resolve.jl

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -594,8 +594,7 @@ function _resolve_pip_diff(old_specs, new_specs)
594594
return (removed, changed, added)
595595
end
596596

597-
function _verbosity_flags()
598-
n = getpref_verbosity()
597+
function _verbosity_flags(n = getpref_verbosity())
599598
n < 0 ? ["-" * "q"^(-n)] : n > 0 ? ["-" * "v"^n] : String[]
600599
end
601600

@@ -995,11 +994,13 @@ function resolve(;
995994
mkpath(dirname(configtomlpath))
996995
write(configtomlpath, configtomlstr)
997996
# initialise pixi
997+
vrb = getpref_verbosity()
998+
vrb_flags = _verbosity_flags(vrb)
998999
_run(
9991000
io,
1000-
pixi_cmd(`init --format pixi $meta_dir`),
1001+
pixi_cmd(`init $vrb_flags --format pixi $meta_dir`),
10011002
"Initialising pixi",
1002-
flags = ["--quiet"],
1003+
flags = vrb_flags,
10031004
)
10041005
# load pixi.toml
10051006
pixitomlpath = joinpath(meta_dir, "pixi.toml")
@@ -1042,18 +1043,22 @@ function resolve(;
10421043
pixitomlstr = sprint(TOML.print, pixitoml)
10431044
write(pixitomlpath, pixitomlstr)
10441045
_log(io, "Wrote $pixitomlpath")
1045-
_logblock(io, eachline(pixitomlpath), color = :light_black)
1046+
if vrb 0
1047+
_logblock(io, eachline(pixitomlpath), color = :light_black)
1048+
end
10461049
if force
10471050
_run(
10481051
io,
1049-
pixi_cmd(`update --manifest-path $pixitomlpath`),
1052+
pixi_cmd(`update $vrb_flags --manifest-path $pixitomlpath`),
10501053
"Updating packages",
1054+
flags = vrb_flags,
10511055
)
10521056
end
10531057
_run(
10541058
io,
1055-
pixi_cmd(`install --manifest-path $pixitomlpath`),
1059+
pixi_cmd(`install $vrb_flags --manifest-path $pixitomlpath`),
10561060
"Installing packages",
1061+
flags = vrb_flags,
10571062
)
10581063
end
10591064
else

0 commit comments

Comments
 (0)