Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revive the data REPL #19

Merged
merged 3 commits into from
Jun 11, 2021
Merged
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
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@ version = "0.2.3"
[deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
ReplMaker = "b873ce64-0db9-51f5-a568-4457d8e49576"
ResourceContexts = "8d208092-d35c-4dd3-a0d7-8325f9cce6b4"
24 changes: 17 additions & 7 deletions src/DataSets.jl
Original file line number Diff line number Diff line change
@@ -321,7 +321,11 @@ function Base.show(io::IO, ::MIME"text/plain", project::AbstractDataProject)
maxwidth = maximum(textwidth.(first.(sorted)))
for (i, (name, data)) in enumerate(sorted)
pad = maxwidth - textwidth(name)
print(io, " ", name, ' '^pad, " => ", data.uuid)
storagetype = get(data.storage, "type", nothing)
icon = storagetype == "Blob" ? '📄' :
storagetype == "BlobTree" ? '📁' :
'❓'
print(io, " ", icon, ' ', name, ' '^pad, " => ", data.uuid)
if i < length(sorted)
println(io)
end
@@ -375,6 +379,8 @@ end
# API for manipulating the stack.
Base.push!(stack::StackedDataProject, project) = push!(stack.projects, project)
Base.pushfirst!(stack::StackedDataProject, project) = pushfirst!(stack.projects, project)
Base.popfirst!(stack::StackedDataProject) = popfirst!(stack.projects)
Base.pop!(stack::StackedDataProject) = pop!(stack.projects)
Base.empty!(stack::StackedDataProject) = empty!(stack.projects)

function Base.show(io::IO, mime::MIME"text/plain", stack::StackedDataProject)
@@ -405,6 +411,14 @@ function expand_project_path(path)
path
end

function data_project_from_path(path)
if path == "@"
project = ActiveDataProject()
else
project = TomlFileDataProject(expand_project_path(path))
end
end

function create_project_stack(env)
stack = []
env_search_path = get(env, "JULIA_DATASETS_PATH", nothing)
@@ -414,11 +428,7 @@ function create_project_stack(env)
paths = split(env_search_path, Sys.iswindows() ? ';' : ':')
end
for path in paths
if path == "@"
project = ActiveDataProject()
else
project = TomlFileDataProject(expand_project_path(path))
end
project = data_project_from_path(path)
push!(stack, project)
end
StackedDataProject(stack)
@@ -577,6 +587,6 @@ include("DataTomlStorage.jl")
# include("GitTree.jl")

# Application-level stuff
# include("repl.jl")
include("repl.jl")

end
Loading