Sha256: e98286c04120685048bda2df583e389075b140570ed32a4060ef21826f4bea04

Contents?: true

Size: 1.71 KB

Versions: 2

Compression:

Stored size: 1.71 KB

Contents

#!/usr/bin/env ruby
$:.push File.join(File.dirname(__FILE__), '..', 'lib')
require 'rubygems'
require 'logger'
require 'optparse'
require 'punchblock/console/cli'

options = { :username         => 'usera@127.0.0.1',
            :password         => '1',
            :auto_reconnect   => false,
            :connection_class => Connection::XMPP }

option_parser = OptionParser.new do |opts|
  opts.banner = "Usage: punchblock-console [-u usera@127.0.0.1] [-p abc123]"
  opts.on("-u", "--username USERNAME", String, "Specify the XMPP JID to connect to") do |u|
    options[:username] = u
  end
  opts.on("-p", "--password PASSWORD", String, "Specify the XMPP password to use") do |p|
    options[:password] = p
  end
  opts.on("-d", "--rayo-domain DOMAIN", String, "Specify the domain Rayo is running on") do |d|
    options[:rayo_domain] = d
  end
  opts.on("--wire-log-file log/wirelog.log", String, "Specify the file to which the wire log should be written") do |wlf|
    options[:wire_log_file] = wlf
  end
  opts.on("--transport-log-file log/transportlog.log", String, "Specify the file to which the transport log should be written") do |tlf|
    options[:transport_log_file] = tlf
  end
  opts.on("--asterisk", "Use Asterisk") do |tlf|
    options[:connection_class] = Connection::Asterisk
    options[:host] = '127.0.0.1'
    options[:port] = 5038
  end
  opts.on("--prompt", "Provide a prompt immediately") do |tlf|
    options[:prompt] = true
  end
  opts.on_tail("-h", "--help", "Show this message") do
    puts opts
    exit
  end
  opts.on_tail("-v", "--version", "Show version") do
    puts VERSION
    exit
  end
end

begin
  option_parser.parse!
rescue
  puts $!
  option_parser.parse '--help'
end

PunchblockConsole::CLI.new(options).run

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
punchblock-console-0.1.2 bin/pbconsole
punchblock-console-0.1.1 bin/pbconsole