How does Pkg preview work?

I canät seem to figure out how to make use of pkg preview. Here’s what I have tried

(v1.0) pkg> preview pkg"add DSP"
ERROR: Wrong number of arguments

(v1.0) pkg> preview add
ERROR: MethodError: Cannot `convert` an object of type String to an object of type Pkg.REPLMode.CommandSpec
Closest candidates are:
  convert(::Type{T}, ::T) where T at essentials.jl:154
  Pkg.REPLMode.CommandSpec(::Any, ::Any, ::Any, ::Any, ::Any, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Pkg/src/REPLMode.jl:111
Stacktrace:
 [1] Pkg.REPLMode.PkgCommand(::Array{Any,1}, ::String, ::Array{Any,1}, ::Array{Pkg.Types.PackageSpec,1}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Pkg/src/REPLMode.jl:325
 [2] do_cmd!(::Pkg.REPLMode.PkgCommand, ::REPL.LineEditREPL) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Pkg/src/REPLMode.jl:535
 [3] #do_cmd#30(::Bool, ::Function, ::REPL.LineEditREPL, ::String) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Pkg/src/REPLMode.jl:507
 [4] do_cmd at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Pkg/src/REPLMode.jl:503 [inlined]
 [5] (::getfield(Pkg.REPLMode, Symbol("##41#44")){REPL.LineEditREPL,REPL.LineEdit.Prompt})(::REPL.LineEdit.MIState, ::Base.GenericIOBuffer{Array{UInt8,1}}, ::Bool) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Pkg/src/REPLMode.jl:842
 [6] #invokelatest#1 at ./essentials.jl:686 [inlined]
 [7] invokelatest at ./essentials.jl:685 [inlined]
 [8] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/REPL/src/LineEdit.jl:2261
 [9] run_frontend(::REPL.LineEditREPL, ::REPL.REPLBackendRef) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/REPL/src/REPL.jl:1029
 [10] run_repl(::REPL.AbstractREPL, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/REPL/src/REPL.jl:191
 [11] (::getfield(Base, Symbol("##720#722")){Bool,Bool,Bool,Bool})(::Module) at ./logging.jl:311
 [12] #invokelatest#1 at ./essentials.jl:686 [inlined]
 [13] invokelatest at ./essentials.jl:685 [inlined]
 [14] macro expansion at ./logging.jl:308 [inlined]
 [15] run_main_repl(::Bool, ::Bool, ::Bool, ::Bool, ::Bool) at ./client.jl:330
 [16] exec_options(::Base.JLOptions) at ./client.jl:242
 [17] _start() at ./client.jl:421

(v1.0) pkg> preview add DSP
ERROR: Wrong number of arguments

(v1.0) pkg> preview "add DSP"
ERROR: 'add DSP' is not a valid command

One possibility is:

Pkg.add("DSP"; preview = true)

It was a bug (Preview command parsing failures · Issue #600 · JuliaLang/Pkg.jl · GitHub) which is now fixed on Pkg master (Fix `preview` and update completions by 00vareladavid · Pull Request #603 · JuliaLang/Pkg.jl · GitHub).

1 Like