Skip to content

Commit

Permalink
doc: include docstrings for Pkg REPL commands in the manual.
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikekre committed Jan 17, 2019
1 parent a1387f5 commit 1524988
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
docs/build
/Manifest.toml
/docs/Manifest.toml
/docs/src/repl.md
.DS_Store
/test/registries/*
49 changes: 49 additions & 0 deletions docs/generate.jl
Original file line number Diff line number Diff line change
@@ -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
<section class="docstring">
<div class="docstring-header">
<a class="docstring-binding" id="repl-$(command)" href="#repl-$(command)">
<code>$(command)</code>
</a>
<span class="docstring-category">REPL command</span>
.
</div>
```
```@eval
using Pkg
Pkg.REPLMode.CommandSpec("$(command)").help
```
```@raw html
</section>
```
""")
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()
3 changes: 3 additions & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
using Documenter
using Pkg

include("generate.jl")

makedocs(
modules = [Pkg],
sitename = "Pkg.jl",
Expand All @@ -16,6 +18,7 @@ makedocs(
"registries.md",
# "faq.md",
"glossary.md",
"repl.md",
"api.md"
],
assets = ["assets/custom.css"],
Expand Down
2 changes: 1 addition & 1 deletion docs/src/api.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 1524988

Please sign in to comment.