Class: Wikiwiki::CLI::Commands::Page::Show
- Defined in:
- lib/wikiwiki/cli/commands/page/show.rb
Overview
Show page metadata
Instance Method Summary collapse
-
#call(page_name:, out: $stdout, err: $stderr, **options) ⇒ void
Execute the show command.
Instance Method Details
#call(page_name:, out: $stdout, err: $stderr, **options) ⇒ void
This method returns an undefined value.
Execute the show command
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/wikiwiki/cli/commands/page/show.rb', line 19 def call(page_name:, out: $stdout, err: $stderr, **) wiki = create_wiki(out:, err:, **) page = wiki.page(page_name:) = { "name" => page.name, "timestamp" => page..iso8601, "source_size" => page.source.bytesize } if [:json] out.puts Formatter::JSON.new.format() else out.puts "Name: #{metadata["name"]}" out.puts "Timestamp: #{metadata["timestamp"]}" out.puts "Source size: #{metadata["source_size"]} bytes" say("Page metadata retrieved", out:, **) end end |