Class: Wikiwiki::CLI::Commands::Attachment::Show
- Defined in:
- lib/wikiwiki/cli/commands/attachment/show.rb
Overview
Show attachment metadata
Instance Method Summary collapse
-
#call(page_name:, file_name:, out: $stdout, err: $stderr, **options) ⇒ void
Execute the show command.
Instance Method Details
#call(page_name:, file_name:, out: $stdout, err: $stderr, **options) ⇒ void
This method returns an undefined value.
Execute the show command
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/wikiwiki/cli/commands/attachment/show.rb', line 21 def call(page_name:, file_name:, out: $stdout, err: $stderr, **) wiki = create_wiki(out:, err:, **) = wiki.(page_name:, attachment_name: file_name) = .to_h.except(:content).transform_values {|v| v.is_a?(Time) ? v.iso8601 : v } if [:json] out.puts Formatter::JSON.new.format() else out.puts "Page: #{metadata[:page_name]}" out.puts "Name: #{metadata[:name]}" out.puts "Size: #{metadata[:size]} bytes" out.puts "Time: #{metadata[:time]}" out.puts "Type: #{metadata[:type]}" say("Attachment metadata retrieved", out:, **) end end |