Skip to content

Commit

Permalink
Deprecate the REPL command ] generate (#1923)
Browse files Browse the repository at this point in the history
  • Loading branch information
DilumAluthge authored Jul 18, 2020
1 parent 3eee6eb commit 13456b9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/REPLMode/command_declarations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ patch version; if the `--fixed` upgrade level is given, then the following
packages will not be upgraded at all.
""",
],[ :name => "generate",
:api => API.generate,
:api => API.generate_deprecated,
:arg_count => 1 => 1,
:arg_parser => ((x,y) -> map(expanduser, unwrap(x))),
:description => "generate files for a new project",
Expand Down
5 changes: 5 additions & 0 deletions src/generate.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

function generate_deprecated(varargs...; kwargs...)
Base.depwarn("Pkg.generate is deprecated. Please use PkgTemplates.jl instead.", Symbol("Pkg.generate"))
return generate(varargs...; kwargs...)
end

generate(path::String; kwargs...) = generate(Context(), path; kwargs...)
function generate(ctx::Context, path::String; kwargs...)
Context!(ctx; kwargs...)
Expand Down
2 changes: 1 addition & 1 deletion test/new.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1816,7 +1816,7 @@ end
isolate() do
Pkg.REPLMode.TEST_MODE[] = true
api, arg, opts = first(Pkg.pkg"generate Foo")
@test api == Pkg.generate
@test api == Pkg.API.generate_deprecated
@test arg == "Foo"
@test isempty(opts)
mktempdir() do dir
Expand Down

0 comments on commit 13456b9

Please sign in to comment.