Module: Rfd

Defined in:
lib/rfd.rb,
lib/rfd/item.rb,
lib/rfd/logging.rb,
lib/rfd/windows.rb,
lib/rfd/commands.rb

Defined Under Namespace

Modules: Commands, Logging Classes: CommandLineWindow, Controller, DebugWindow, HeaderLeftWindow, HeaderRightWindow, Item, MainWindow, Window

Constant Summary collapse

VERSION =
Gem.loaded_specs['rfd'] ? Gem.loaded_specs['rfd'].version.to_s : '0'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.loggerObject (readonly)

Returns the value of attribute logger.



20
21
22
# File 'lib/rfd/logging.rb', line 20

def logger
  @logger
end

Class Method Details

.init_cursesObject

:nodoc:



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/rfd.rb', line 18

def self.init_curses
  Curses.init_screen
  Curses.raw
  Curses.noecho
  Curses.curs_set 0
  Curses.stdscr.keypad = true
  Curses.start_color

  [Curses::COLOR_WHITE, Curses::COLOR_CYAN, Curses::COLOR_MAGENTA, Curses::COLOR_GREEN, Curses::COLOR_RED].each do |c|
    Curses.init_pair c, c, Curses::COLOR_BLACK
  end

  Curses.mousemask Curses::BUTTON1_CLICKED | Curses::BUTTON1_DOUBLE_CLICKED
end

.log(str) ⇒ Object



16
17
18
# File 'lib/rfd/logging.rb', line 16

def log(str)
  Rfd.logger.debug str if Rfd.logger
end

.log_to(file) ⇒ Object



9
10
11
12
13
14
# File 'lib/rfd/logging.rb', line 9

def log_to(file)
  @logger = Logger.new file
  @logger.debug 'hello'

  Rfd::Controller.include Logging
end

.start(dir = '.', log: nil) ⇒ Object

Start the app here!

Parameters

  • dir - The initial directory.



37
38
39
40
41
42
43
44
45
46
47
# File 'lib/rfd.rb', line 37

def self.start(dir = '.', log: nil)
  Rfd.log_to log if log

  init_curses
  Rfd::Window.draw_borders
  Curses.stdscr.noutrefresh
  rfd = Rfd::Controller.new
  rfd.cd dir
  Curses.doupdate
  rfd
end