Class: Wikiwiki::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/wikiwiki/cli.rb,
lib/wikiwiki/cli/commands/auth.rb,
lib/wikiwiki/cli/commands/base.rb,
lib/wikiwiki/cli/formatter/json.rb,
lib/wikiwiki/cli/commands/page/get.rb,
lib/wikiwiki/cli/commands/page/put.rb,
lib/wikiwiki/cli/commands/page/list.rb,
lib/wikiwiki/cli/commands/page/show.rb,
lib/wikiwiki/cli/commands/page/delete.rb,
lib/wikiwiki/cli/commands/attachment/get.rb,
lib/wikiwiki/cli/commands/attachment/put.rb,
lib/wikiwiki/cli/commands/attachment/list.rb,
lib/wikiwiki/cli/commands/attachment/show.rb,
lib/wikiwiki/cli/commands/attachment/delete.rb

Overview

Command-line interface for Wikiwiki

Provides commands for managing wiki pages and attachments through the terminal. Supports authentication via API key or password, with configurable logging and output modes.

Defined Under Namespace

Modules: Commands, Formatter

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(out: $stdout, err: $stderr) ⇒ CLI

Initialize the CLI with output streams

Parameters:

  • out (IO) (defaults to: $stdout)

    standard output (defaults to $stdout)

  • err (IO) (defaults to: $stderr)

    error output (defaults to $stderr)



16
17
18
19
20
# File 'lib/wikiwiki/cli.rb', line 16

def initialize(out: $stdout, err: $stderr)
  @out = out
  @err = err
  @dry_cli = Dry::CLI.new(Commands)
end

Instance Attribute Details

#errObject (readonly)

Returns the value of attribute err.



36
37
38
# File 'lib/wikiwiki/cli.rb', line 36

def err
  @err
end

#outObject (readonly)

Returns the value of attribute out.



35
36
37
# File 'lib/wikiwiki/cli.rb', line 35

def out
  @out
end

Instance Method Details

#run(argv) ⇒ Integer

Run the CLI with given arguments

Parameters:

  • argv (Array<String>)

    command-line arguments

Returns:

  • (Integer)

    exit code (0 for success, 1 for error)



26
27
28
29
30
31
32
33
# File 'lib/wikiwiki/cli.rb', line 26

def run(argv)
  @debug = argv.include?("--debug")
  @dry_cli.call(arguments: argv, out: @out, err: @err)
  0
rescue => e
  handle_error(e)
  1
end