43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
# File 'lib/jabber-tee/cli.rb', line 43
def parse_options(args)
@options ||= {}
@parsed_options ||= OptionParser.new do |opts|
opts.banner = "Usage: #{File.basename($0)} [OPTIONS] "
opts.separator <<DESC
Description:
This is a simple tool for reading from STDIN and writing
to both STDOUT and a remote jabber server. It does not handle
reading from STDERR, so you will need to re-direct 2>&1 before
piping it to this tool.
The configuration file should live under ~/.jabber-tee.yml.
Please see http://github.com/gabemc/jabber-tee for more
information.
Options:
DESC
opts.separator " Connecting:"
opts.on('-u', '--username USERNAME',
"The [email protected] name to connect to the jabber server.") do |u|
options[:username] = u
end
opts.on('-p', '--password PASSWORD',
"The password for the user to connect to the jabber server.",
"If not given or defined in the .jabber-tee.yml file,",
"it will be asked during runtime.") do |p|
options[:password] = p
end
opts.on('-n', '--nick NICKNAME',
"The nickname to use when connecting to the server.") do |n|
options[:nick] = n
end
opts.on('-a', '--anonymous',
"Disregards the username information and logs in using anonymous",
"authentication. Either the --username or the --authentication",
"flag are required.") do |a|
options[:anonymous] = true
end
opts.on('-P', '--profile PROFILE',
"The name of the profile, as defined in the .jabber-tee.yml",
"file to use to connect with.") do |p|
options[:profile] = p
end
opts.on('--sasl',
"By default, the connection does not use SASL authentication.",
"This enables SASL connections") do |s|
options[:sasl] = true
end
opts.on('--digest',
"When not using SASL, you can use the digest",
"authentication mechanism.") do |d|
options[:digest] = true
end
opts.separator ""
opts.separator " Output: (One required)"
opts.on('-t', '--to TO',
"Who to send the message to.") do |t|
options[:to] = t
end
opts.on('-r', '--room ROOM',
"The room to send the messages to.") do |r|
options[:room] = r
end
opts.separator ""
opts.separator " Informative:"
opts.on('-v', '--version',
"Show the version information") do |v|
puts "#{File.basename($0)} version: #{JabberTee::Version.to_s}"
exit
end
opts.on('-h', '--help',
"Show this help message") do
puts opts
exit
end
opts.separator ""
end.parse!(args)
end
|