Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion src/Operations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1677,9 +1677,33 @@ function add(ctx::Context, pkgs::Vector{PackageSpec}, new_git=Set{UUID}();
else
record_project_hash(ctx.env)
write_env(ctx.env)
names_str = join(names, ", ")
names_str = join(names, ", ", " and ")
printpkgstyle(ctx.io, :Added, "$names_str to [$(target)]")
end
if target == :weakdeps
possible_extension_name = join(names) * "Ext"
if !haskey(ctx.env.project.exts, possible_extension_name)
plural = length(names) > 1 ? "these weak dependencies" : "this weak dependency"
printpkgstyle(
ctx.io,
:Option,
"Would you like to create a new entry for extension `$possible_extension_name` with $(plural)? ",
color=Base.info_color(),
newline=false
)
ans = if isinteractive()
Base.prompt(stdin, ctx.io, "[Y/n]")
else
"y"
end
if lowercase(ans) in ("y", "")
ctx.env.project.exts[possible_extension_name] = collect(names)
record_project_hash(ctx.env)
write_env(ctx.env)
printpkgstyle(ctx.io, :Created, "extension $possible_extension_name")
end
end
end
return
end

Expand Down
23 changes: 12 additions & 11 deletions src/project.jl
Original file line number Diff line number Diff line change
Expand Up @@ -241,18 +241,19 @@ function destructure(project::Project)::Dict
should_delete(src) ? delete!(raw, key) : (raw[key] = src)
end

entry!("name", project.name)
entry!("uuid", project.uuid)
entry!("version", project.version)
entry!("name", project.name)
entry!("uuid", project.uuid)
entry!("version", project.version)
entry!("workspace", project.workspace)
entry!("manifest", project.manifest)
entry!("entryfile", project.entryfile)
entry!("deps", merge(project.deps, project._deps_weak))
entry!("weakdeps", project.weakdeps)
entry!("sources", project.sources)
entry!("extras", project.extras)
entry!("compat", Dict(name => x.str for (name, x) in project.compat))
entry!("targets", project.targets)
entry!("manifest", project.manifest)
entry!("entryfile", project.entryfile)
entry!("deps", merge(project.deps, project._deps_weak))
entry!("weakdeps", project.weakdeps)
entry!("sources", project.sources)
entry!("extras", project.extras)
entry!("compat", Dict(name => x.str for (name, x) in project.compat))
entry!("targets", project.targets)
entry!("extensions", project.exts)
return raw
end

Expand Down
5 changes: 3 additions & 2 deletions src/utils.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@

function printpkgstyle(io::IO, cmd::Symbol, text::String, ignore_indent::Bool=false; color=:green)
function printpkgstyle(io::IO, cmd::Symbol, text::String, ignore_indent::Bool=false; color=:green, newline::Bool=true)
indent = textwidth(string(:Precompiling)) # "Precompiling" is the longest operation
ignore_indent && (indent = 0)
printstyled(io, lpad(string(cmd), indent), color=color, bold=true)
println(io, " ", text)
print(io, " ", text)
newline && println(io)
end

function linewrap(str::String; io = stdout_f(), padding = 0, width = Base.displaysize(io)[2])
Expand Down
Loading