Class: Muxoro::CLI
- Inherits:
-
Object
- Object
- Muxoro::CLI
- Defined in:
- lib/muxoro/cli.rb
Instance Attribute Summary collapse
-
#help_asked ⇒ Object
readonly
Returns the value of attribute help_asked.
-
#orange_bg ⇒ Object
readonly
Returns the value of attribute orange_bg.
-
#orange_fg ⇒ Object
readonly
Returns the value of attribute orange_fg.
-
#orange_zone ⇒ Object
readonly
Returns the value of attribute orange_zone.
-
#red_bg ⇒ Object
readonly
Returns the value of attribute red_bg.
-
#red_fg ⇒ Object
readonly
Returns the value of attribute red_fg.
-
#red_zone ⇒ Object
readonly
Returns the value of attribute red_zone.
-
#short_sleep_interval ⇒ Object
readonly
Returns the value of attribute short_sleep_interval.
-
#sleep_interval ⇒ Object
readonly
Returns the value of attribute sleep_interval.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
-
#tmux ⇒ Object
readonly
Returns the value of attribute tmux.
Instance Method Summary collapse
Instance Attribute Details
#help_asked ⇒ Object (readonly)
Returns the value of attribute help_asked.
7 8 9 |
# File 'lib/muxoro/cli.rb', line 7 def help_asked @help_asked end |
#orange_bg ⇒ Object (readonly)
Returns the value of attribute orange_bg.
7 8 9 |
# File 'lib/muxoro/cli.rb', line 7 def orange_bg @orange_bg end |
#orange_fg ⇒ Object (readonly)
Returns the value of attribute orange_fg.
7 8 9 |
# File 'lib/muxoro/cli.rb', line 7 def orange_fg @orange_fg end |
#orange_zone ⇒ Object (readonly)
Returns the value of attribute orange_zone.
7 8 9 |
# File 'lib/muxoro/cli.rb', line 7 def orange_zone @orange_zone end |
#red_bg ⇒ Object (readonly)
Returns the value of attribute red_bg.
7 8 9 |
# File 'lib/muxoro/cli.rb', line 7 def red_bg @red_bg end |
#red_fg ⇒ Object (readonly)
Returns the value of attribute red_fg.
7 8 9 |
# File 'lib/muxoro/cli.rb', line 7 def red_fg @red_fg end |
#red_zone ⇒ Object (readonly)
Returns the value of attribute red_zone.
7 8 9 |
# File 'lib/muxoro/cli.rb', line 7 def red_zone @red_zone end |
#short_sleep_interval ⇒ Object (readonly)
Returns the value of attribute short_sleep_interval.
7 8 9 |
# File 'lib/muxoro/cli.rb', line 7 def short_sleep_interval @short_sleep_interval end |
#sleep_interval ⇒ Object (readonly)
Returns the value of attribute sleep_interval.
7 8 9 |
# File 'lib/muxoro/cli.rb', line 7 def sleep_interval @sleep_interval end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
7 8 9 |
# File 'lib/muxoro/cli.rb', line 7 def time @time end |
#tmux ⇒ Object (readonly)
Returns the value of attribute tmux.
9 10 11 |
# File 'lib/muxoro/cli.rb', line 9 def tmux @tmux end |
Instance Method Details
#help ⇒ Object
11 12 13 14 15 |
# File 'lib/muxoro/cli.rb', line 11 def help return nil unless help_asked $stderr.puts help_text true end |
#init(args) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/muxoro/cli.rb', line 17 def init args @help_asked = args.include? ":help" @time = get_int_from( args, 'time:', 25 ) * 60 @sleep_interval = get_int_from args, 'sleep_interval:', 60 @short_sleep_interval = get_int_from args, 'short_sleep_interval:', 10 @orange_zone = get_int_from args, 'orange_zone:', 300 @red_zone = get_int_from args, 'red_zone:',60 @red_bg = get_str_from args, 'red_bg:', 'red' @orange_bg = get_str_from args, 'orange_bg:', '#882288' @red_fg = get_str_from args, 'red_fg:', 'black' @orange_fg = get_str_from args, 'orange_fg:', 'green' # @logger = Logger.new File.expand_local_path{ %W{ .. .. log #{self.class.name.split("::").last}.log} } # log "#{inspect} initialized" self end |
#reset ⇒ Object
34 35 36 |
# File 'lib/muxoro/cli.rb', line 34 def reset tmux.set_left_status fg: 'cyan', time: '', bg: '#222222' end |
#run!(session_name) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/muxoro/cli.rb', line 38 def run! session_name # log ">>>run!" @tmux = Tmux.new session_name # , @logger # log "tmux created" loop do set_current_status break if finished? wait_tick end reset end |