Skip to content

Commit

Permalink
prettier command printing
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Doris committed Jan 27, 2022
1 parent 46d977c commit 8630262
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/CondaPkg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ end

function _resolve_conda_remove(io, conda_env)
cmd = MicroMamba.cmd(`remove -y -p $conda_env --all`, io=io)
_run(io, cmd, "Removing environment")
_run(io, cmd, "Removing environment", flags=["-y", "--all"])
nothing
end

Expand All @@ -279,7 +279,7 @@ function _resolve_conda_create(io, conda_env, specs, channels)
push!(args, "-c", channel)
end
cmd = MicroMamba.cmd(`create -y -p $conda_env --no-channel-priority $args`, io=io)
_run(io, cmd, "Creating environment")
_run(io, cmd, "Creating environment", flags=["-y", "--no-channel-priority"])
nothing
end

Expand Down Expand Up @@ -314,10 +314,21 @@ function _log(io::IO, args...)
flush(io)
end

function _run(io::IO, cmd::Cmd, args...)
function _run(io::IO, cmd::Cmd, args...; flags=String[])
_log(io, args...)
for x in cmd.exec
println(io, " ", x)
i = 1
while i length(cmd.exec)
x = cmd.exec[i]
print(io, " ")
printstyled(io, x, color=:light_black)
i += 1
if 2 < i length(cmd.exec) && startswith(x, "-") && x flags
x = cmd.exec[i]
print(io, " ")
printstyled(io, x, color=:light_black)
i += 1
end
println(io)
end
run(cmd)
end
Expand Down

2 comments on commit 8630262

@cjdoris
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/53278

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.2.5 -m "<description of version>" 863026227bc0ff917d857e8b2a775f513520db06
git push origin v0.2.5

Please sign in to comment.