diff --git a/.gitignore b/.gitignore index 723069de6c..56eead5f18 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,6 @@ docs/build /Manifest.toml /docs/Manifest.toml +/docs/src/repl.md .DS_Store /test/registries/* diff --git a/docs/generate.jl b/docs/generate.jl new file mode 100644 index 0000000000..bad46076f8 --- /dev/null +++ b/docs/generate.jl @@ -0,0 +1,49 @@ +# This file is a part of Julia. License is MIT: https://julialang.org/license + +## generate repl-docs ## + +function generate(io, command) + println(io, """ + ```@raw html +
+
+ + $(command) + + — + REPL command + . +
+ ``` + ```@eval + using Pkg + Pkg.REPLMode.CommandSpec("$(command)").help + ``` + ```@raw html +
+ ``` + """) +end +function generate() + io = IOBuffer() + println(io, """ + # [**9.** REPL Mode Reference](@id REPL-Mode-Reference) + + This section describes available commands in the Pkg REPL. + The REPL mode is mostly meant for interactive use, + and for non-interactive use it is recommended to use the + "API mode", see [API Reference](@ref API-Reference). + """) + # list commands + println(io, "## `package` commands") + foreach(command -> generate(io, command), ["add", "build", "develop", "free", "generate", "pin", "remove", "test", "update"]) + println(io, "## `registry` commands") + foreach(command -> generate(io, command), ["registry-add", "registry-remove", "registry-status", "registry-update"]) + println(io, "## Other commands") + foreach(command -> generate(io, command), ["activate", "gc", "help", "instantiate", "precompile", "resolve", "status"]) + # write to file + write(joinpath(@__DIR__, "src", "repl.md"), seekstart(io)) + return +end + +generate() diff --git a/docs/make.jl b/docs/make.jl index 72617b3a82..26f34dcb48 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -3,6 +3,8 @@ using Documenter using Pkg +include("generate.jl") + makedocs( modules = [Pkg], sitename = "Pkg.jl", @@ -16,6 +18,7 @@ makedocs( "registries.md", # "faq.md", "glossary.md", + "repl.md", "api.md" ], assets = ["assets/custom.css"], diff --git a/docs/src/api.md b/docs/src/api.md index 386891ec6a..9a9c39f559 100644 --- a/docs/src/api.md +++ b/docs/src/api.md @@ -1,4 +1,4 @@ -# [**9.** API Reference](@id API-Reference) +# [**10.** API Reference](@id API-Reference) This section describes the function interface, or "API mode" for interacting with Pkg.jl. The function API is recommended