lib/space/app.rb in space-0.0.6 vs lib/space/app.rb in space-0.0.7
- old
+ new
@@ -2,43 +2,36 @@
require 'readline'
require 'thread'
module Space
class App
- attr_reader :name, :project, :screen
+ attr_reader :name, :project, :views
def initialize(name)
@name = name
@project = Model::Project.new(name)
- @screen = Screen.new(project)
+ @views = [View::Progress.new(project), View::Dashboard.new(project)]
end
def run
- screen.display
project.refresh
cli_loop
- # Thread.new(&method(:cli_loop))
- # sleep
puts
end
private
def cli_loop
loop do
print "\e[3;0H"
- line = Readline.readline(prompt, true) || break
+ line = Readline.readline(views.first.send(:prompt), true) || break
handle(line)
end
rescue Exception => e
log e.message, e.backtrace
end
def handle(line)
Action::Handler.new(project).run(line) unless line.empty?
- end
-
- def prompt
- "#{project.repos.scoped? ? project.repos.scope.map { |r| r.name }.join(', ') : project.name} > "
end
end
end