|
@@ -3,6 +3,8 @@
|
|
|
local cli = require "cli"
|
|
|
local plpath = require "pl.path"
|
|
|
|
|
|
+local term = require "volksdata.term"
|
|
|
+
|
|
|
local pkar = require "pocket_archive"
|
|
|
local sub = require "pocket_archive.submission"
|
|
|
local hgen = require "pocket_archive.html_generator"
|
|
@@ -42,13 +44,34 @@ submit = cli.command {
|
|
|
end
|
|
|
}
|
|
|
|
|
|
-generate = cli.command {
|
|
|
+gen_site = cli.command {
|
|
|
"Generate a static site from the archive.",
|
|
|
|
|
|
function(args) hgen.generate_site() end
|
|
|
}
|
|
|
|
|
|
|
|
|
+gen_rdf = cli.command {
|
|
|
+ "Generate an RDF representation of a resource.",
|
|
|
+
|
|
|
+ cli.positional "id" {
|
|
|
+ "ID of the resource, prefixed by `par:`",
|
|
|
+ type = cli.string,
|
|
|
+ },
|
|
|
+ cli.flag "f,format" {
|
|
|
+ "RDF format. `nt` and `ttl` are available.",
|
|
|
+ type = cli.string,
|
|
|
+ default = "ttl",
|
|
|
+ },
|
|
|
+
|
|
|
+ function(args)
|
|
|
+ local s = term.new_iriref_ns(args.id)
|
|
|
+ local res_gr = hgen.get_graph(s)
|
|
|
+ print(res_gr:encode(args.format))
|
|
|
+ end,
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
cli.program {
|
|
|
"Pocket Archive command line interface.",
|
|
|
}
|