Sha256: 5bb81f548c232ea592fbdccb05b19eb166e5d332a6f2bce4a4461245000b23b4

Contents?: true

Size: 814 Bytes

Versions: 5

Compression:

Stored size: 814 Bytes

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require 'bundler/setup'

require 'ronin/core/cli/command_shell'

#
# An example interactive CLI shell.
#
class TestShell < Ronin::Core::CLI::CommandShell

  shell_name 'test'

  command :foo, summary: 'Command with no arguments'
  def foo
    puts "no args"
  end

  command :bar, usage:       'ARG',
                completions: %w[arg1 arg2],
                summary:     'Command with one argument'
  def bar(arg)
    puts "arg=#{arg}"
  end

  command :baz, usage:   '[ARG]',
                summary: 'Command with optional argument'
  def baz(arg=nil)
    puts "arg=#{arg}"
  end

  command :qux, usage:   '[ARGS...]',
                summary: 'Command with repeating arguments'
  def qux(*args)
    puts "args=#{args.join(' ')}"
  end

end

TestShell.start

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ronin-core-0.2.0 examples/test_shell.rb
ronin-core-0.2.0.rc1 examples/test_shell.rb
ronin-core-0.1.3 examples/test_shell.rb
ronin-core-0.1.2 examples/test_shell.rb
ronin-core-0.1.1 examples/test_shell.rb