Class: Wikiwiki::CLI::Commands::Page::List

Inherits:
Base
  • Object
show all
Defined in:
lib/wikiwiki/cli/commands/page/list.rb

Overview

List all pages in the wiki

Instance Method Summary collapse

Instance Method Details

#call(out: $stdout, err: $stderr, **options) ⇒ void

This method returns an undefined value.

Execute the list command

Parameters:

  • options (Hash)

    command options including wiki_id, auth, json, verbose, out, err



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/wikiwiki/cli/commands/page/list.rb', line 19

def call(out: $stdout, err: $stderr, **options)
  wiki = create_wiki(out:, err:, **options)
  page_names = wiki.page_names

  if options[:json]
    out.puts Formatter::JSON.new.format(page_names)
  else
    page_names.each {|name| out.puts name }
    say("#{page_names.size} pages found", out:, **options)
  end
end