~ubuntu-branches/ubuntu/vivid/rabbit/vivid

« back to all changes in this revision

Viewing changes to bin/rabbit-command

  • Committer: Bazaar Package Importer
  • Author(s): Youhei SASAKI
  • Date: 2009-07-22 22:15:37 UTC
  • Revision ID: james.westby@ubuntu.com-20090722221537-iy7foj73p2kyuumi
Tags: upstream-0.6.1
ImportĀ upstreamĀ versionĀ 0.6.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env ruby
 
2
# -*- ruby -*-
 
3
 
 
4
require 'drb/drb'
 
5
 
 
6
require "rabbit/console"
 
7
 
 
8
def parse(args=ARGV, logger=nil)
 
9
  Rabbit::Console.parse!(args, logger) do |opts, options|
 
10
    options.druby_uri = "druby://localhost:10101"
 
11
    options.commands = []
 
12
 
 
13
    opts.separator ""
 
14
 
 
15
    opts.on("--druby-uri=URI",
 
16
            _("Specify Rabbit's dRuby URI as [URI]."),
 
17
            "(#{options.druby_uri})") do |uri|
 
18
      options.druby_uri = uri
 
19
    end
 
20
 
 
21
    opts.separator(_("Move commands"))
 
22
 
 
23
    opts.on("--previous", _("Move to previous")) do
 
24
      options.commands << [:move_to_previous_if_can]
 
25
    end
 
26
 
 
27
    opts.on("--next", _("Move to next")) do
 
28
      options.commands << [:move_to_next_if_can]
 
29
    end
 
30
 
 
31
    opts.on("--previous-slide", _("Move to the previous slide")) do
 
32
      options.commands << [:move_to_previous_slide_if_can]
 
33
    end
 
34
 
 
35
    opts.on("--next-slide", _("Move to the next slide")) do
 
36
      options.commands << [:move_to_next_slide_if_can]
 
37
    end
 
38
 
 
39
    opts.on("--first-slide", _("Move to the first slide")) do
 
40
      options.commands << [:move_to_first]
 
41
    end
 
42
 
 
43
    opts.on("--last-slide", _("Move to the last slide")) do
 
44
      options.commands << [:move_to_last]
 
45
    end
 
46
 
 
47
    opts.on("--jump-to=N", Integer, _("Move to the Nth slide")) do |n|
 
48
      options.commands << [:move_to_if_can, n]
 
49
    end
 
50
 
 
51
    opts.separator(_("Control commands"))
 
52
 
 
53
    opts.on("--toggle-fullscreen", _("Toggle fullscreen")) do
 
54
      options.commands << [:toggle_fullscreen]
 
55
   end
 
56
 
 
57
    opts.on("--toggle-index-mode", _("Toggle index mode")) do
 
58
      options.commands << [:toggle_index_mode]
 
59
   end
 
60
 
 
61
    opts.on("--toggle-whiteout", _("Toggle whiteout")) do
 
62
      options.commands << [:toggle_whiteout]
 
63
   end
 
64
 
 
65
    opts.on("--toggle-blackout", _("Toggle blackout")) do
 
66
      options.commands << [:toggle_blackout]
 
67
   end
 
68
 
 
69
    opts.on("--quit", _("Quit")) do
 
70
      options.commands << [:quit]
 
71
   end
 
72
  end
 
73
end
 
74
 
 
75
def main
 
76
  options, logger = parse
 
77
 
 
78
  rabbit = DRbObject.new_with_uri(options.druby_uri)
 
79
  options.commands.each do |method, *args|
 
80
    rabbit.send(method, *args)
 
81
  end
 
82
end
 
83
 
 
84
main