lib/hx/cli.rb in hx-0.23.0 vs lib/hx/cli.rb in hx-0.24.0
- old
+ new
@@ -47,10 +47,11 @@
Usage: hx [--config CONFIG_FILE] [upgen]
hx [--config CONFIG_FILE] regen
hx [--config CONFIG_FILE] post[up] SOURCE:PATH
hx [--config CONFIG_FILE] edit[up] SOURCE:PATH
hx [--config CONFIG_FILE] list SOURCE:PATTERN
+ hx [--config CONFIG_FILE] dump SOURCE:PATTERN
hx [--config CONFIG_FILE] serve [PORT]
EOS
opts.on("-c", "--config CONFIG_FILE",
@@ -205,9 +206,18 @@
end
def self.cmd_list(site, entry_spec)
source, selector = parse_entry_pattern(site, entry_spec)
source.each_entry_path(selector) { |path| puts path }
+end
+
+def self.cmd_dump(site, entry_spec)
+ source, selector = parse_entry_pattern(site, entry_spec)
+ items = []
+ source.each_entry(selector) do |path, entry|
+ items << {path => entry}
+ end
+ puts YAML.dump(items)
end
def self.do_edit(site, source, path, prototype)
catch(:unchanged) do
begin