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
5 changes: 5 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ version = "0.20.21"

[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
Comonicon = "863f3e99-da2a-4334-8734-de3dacbe5542"
Configurations = "5218b696-f38b-4ac9-8b61-a12ec717816d"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
Expand Down Expand Up @@ -40,6 +41,7 @@ UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"

[compat]
Base64 = "1"
Comonicon = "1"
Configurations = "0.15, 0.16, 0.17"
Dates = "0, 1"
Downloads = "1"
Expand Down Expand Up @@ -72,6 +74,9 @@ URIs = "1.3"
UUIDs = "1"
julia = "^1.10"

[apps.pluto]
submodule = "PlutoApp"

[extras]
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Memoize = "c03570c3-d221-55d1-a50c-7939bbd78826"
Expand Down
4 changes: 4 additions & 0 deletions src/Pluto.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ include("./webserver/Dynamic.jl")
include("./webserver/REPLTools.jl")
include("./webserver/WebServer.jl")

@static if VERSION >= v"1.11"
include("PlutoApp.jl")
end

const reset_notebook_environment = PkgUtils.reset_notebook_environment
const update_notebook_environment = PkgUtils.update_notebook_environment
const activate_notebook_environment = PkgUtils.activate_notebook_environment
Expand Down
31 changes: 31 additions & 0 deletions src/PlutoApp.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module PlutoApp

using Pluto
import Comonicon

# Note we need the `# Intro` header for Comonicon to pick up this docstring.
"""
# Intro
The `pluto` executable exposes a simple CLI interface for the `Pluto.run(; ...)` function.
It is supposed to be used via Julia ["apps"](https://pkgdocs.julialang.org/v1/apps/) from Julia 1.11+ and typically lives in your `\$PATH`.
It can be installed via `julia -e "import Pkg; Pkg.Apps.add(\"Pluto\")"`.
"""
Comonicon.@main function pluto(notebooks::String...;
dont_launch_browser::Bool=false, # Comonicon flags must default to false
port::Int=-1, # Union{Nothing, Int} not supported by Comonicon
host::String="127.0.0.1",
auto_reload_from_file::Bool=false
)
notebook = (isempty(notebooks) ? nothing : collect(notebooks))
port = (port == -1 ? nothing : port)
launch_browser = !dont_launch_browser
Pluto.run(; notebook, launch_browser, port, host, auto_reload_from_file)
return
end
function (Base.@main)(ARGS::Vector{String})
# this function is generated into the current module by Comonicon
# and will ultimately call the function above annotated by `Comonicon.@main`
return command_main(ARGS)
end

end
Loading