Open file directly
AshtonSBradley opened this issue · 10 comments
Sorry if this is misplaced, but I am wondering if I can open a particular notebook by passing a filename at the command line?
I mean that it could just open in the system default browser at a default port
Those are two separate requests:
fonsp/Pluto.jl#236 @Roger-luo this can be added to the CLI right?
fonsp/Pluto.jl#190
Thanks! I tried fonsp/Pluto.jl#236 and left a comment there about what went wrong for me
yes, this should be fairly easy to add to the CLI. I could do it in a PR.
@fonsp just wondering if it's possible to pass the environment path to the notebook process (when creating it) directly? e.g some internal APIs that I can call. I cannot find where Pluto create the process after reading the code, I thought there will be some call to addprocs
somewhere...
now since we need to have a new command open
in CLI, I will need to create some subprocess myself to set JULIA_PROJECT
back (to fix the CLI's deps version, I need to run CLI in a read only julia environment, which is currently the package environment).
ah I think I found it, are notebook process created by this line? https://github.com/fonsp/Pluto.jl/blob/d4be9bfc927c3d7ac12824a31361f7456f6f3ab3/src/evaluation/WorkspaceManager.jl#L85
Yep! The next lines run a number of commands (process_preamble
) on the new process.
not sure if it should be working yet, but since those PRs on opening from command line merged, I tried it and got
abradley@gink ~/Dropbox/Julia/Pluto pluto open aliasing.jl
ERROR: LoadError: UndefVarError: ServerConfiguration not defined
Stacktrace:
[1] getproperty(x::Module, f::Symbol)
@ Base ./Base.jl:26
[2] open(file::String; host::String, port::Int64, launchbrowser::Bool, project::Nothing)
@ PlutoUtils ~/.julia/packages/PlutoUtils/5FSCF/src/PlutoUtils.jl:26
[3] open(file::String)
@ PlutoUtils ~/.julia/packages/PlutoUtils/5FSCF/src/PlutoUtils.jl:24
[4] command_main(ARGS::Vector{String})
@ PlutoUtils ~/.julia/packages/Comonicon/R34G0/src/codegen/ast.jl:202
[5] command_main()
@ PlutoUtils ~/.julia/packages/Comonicon/R34G0/src/codegen/ast.jl:46
[6] top-level scope
@ ~/.julia/bin/pluto.jl:1
is there something more for me to do to setup? (just went through the readme. on master for both Pluto and PlutoUtils)
@AshtonSBradley thanks for trying, and sorry for the inconvenience of the early stage, if you want to try it now, you can do
] add Pluto#master PlutoUtils#roger/cli
we need to wait for Pluto v0.12.0 to get tagged for this feature.
Just a heads up that 0.12 is now actually released :)