ruby-bugzilla 0.2 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/bzconsole +35 -37
- data/lib/bugzilla.rb +1 -1
- metadata +3 -2
data/bin/bzconsole
CHANGED
@@ -32,8 +32,8 @@ require 'uri'
|
|
32
32
|
$KCODE = 'u'
|
33
33
|
|
34
34
|
begin
|
35
|
-
|
36
|
-
rescue
|
35
|
+
require 'bugzilla'
|
36
|
+
rescue LoadError
|
37
37
|
require File.join(File.dirname(__FILE__), "..", "lib", "bugzilla.rb")
|
38
38
|
$:.push(File.join(File.dirname(__FILE__), "..", "lib"))
|
39
39
|
end
|
@@ -703,49 +703,47 @@ module BzConsole
|
|
703
703
|
|
704
704
|
end # module BzConsole
|
705
705
|
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
subargv = []
|
706
|
+
begin
|
707
|
+
opts = {}
|
708
|
+
opts[:command] = {}
|
709
|
+
subargv = []
|
711
710
|
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
711
|
+
o = ARGV.options do |opt|
|
712
|
+
opt.banner = sprintf("Usage: %s [global options] <command> ...", File.basename(__FILE__))
|
713
|
+
opt.separator ""
|
714
|
+
opt.separator "Global options:"
|
715
|
+
opt.on('-c', '--config=FILE', 'read FILE as the configuration file.') {|v| opts[:config] = v}
|
716
|
+
opt.on('-h', '--help', 'show this message') {|x| opts[:help] = true}
|
718
717
|
|
719
|
-
|
718
|
+
cmds = BzConsole.constants.sort.map {|x| (k = eval("BzConsole::#{x}")).class == Class && x != "CommandTemplate" ? x.downcase : nil}.compact
|
720
719
|
|
721
|
-
|
720
|
+
subargv = opt.order(ARGV);
|
722
721
|
|
723
|
-
|
722
|
+
command = subargv[0]
|
724
723
|
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
else
|
731
|
-
STDERR.printf("E: Unknown command: %s\n", subargv[0])
|
732
|
-
STDERR.printf(" Available commands: %s\n", cmds.join(' '))
|
733
|
-
exit 1
|
734
|
-
end
|
724
|
+
if subargv.length > 0 then
|
725
|
+
n = cmds.index(command)
|
726
|
+
unless n.nil? then
|
727
|
+
opts[:instance] = eval("BzConsole::#{cmds[n].capitalize}.new(Bugzilla::Plugin::Template.new)")
|
728
|
+
subargv = opts[:instance].parse(opt, subargv[1..-1], opts[:command])
|
735
729
|
else
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
end
|
740
|
-
|
741
|
-
if opts[:instance].nil? && subargv.length == 0 ||
|
742
|
-
opts[:help] == true ||
|
743
|
-
subargv.length < opts[:instance].n_args then
|
744
|
-
puts opt.help
|
745
|
-
exit
|
730
|
+
STDERR.printf("E: Unknown command: %s\n", subargv[0])
|
731
|
+
STDERR.printf(" Available commands: %s\n", cmds.join(' '))
|
732
|
+
exit 1
|
746
733
|
end
|
734
|
+
else
|
735
|
+
opt.separator ""
|
736
|
+
opt.separator "Available commands:"
|
737
|
+
opt.separator sprintf(" %s", cmds.join(' '))
|
747
738
|
end
|
748
739
|
|
749
|
-
opts[:instance].
|
740
|
+
if opts[:instance].nil? && subargv.length == 0 ||
|
741
|
+
opts[:help] == true ||
|
742
|
+
subargv.length < opts[:instance].n_args then
|
743
|
+
puts opt.help
|
744
|
+
exit
|
745
|
+
end
|
750
746
|
end
|
747
|
+
|
748
|
+
opts[:instance].do(subargv, opts)
|
751
749
|
end
|
data/lib/bugzilla.rb
CHANGED
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-bugzilla
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
|
9
|
+
- 1
|
10
|
+
version: 0.2.1
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Akira TAGOH
|