Class: Wlog::GitUi
- Inherits:
-
Object
- Object
- Wlog::GitUi
- Defined in:
- lib/wlog/ui/git_ui.rb
Overview
Instance Method Summary collapse
-
#initialize ⇒ GitUi
constructor
A new instance of GitUi.
- #run ⇒ Object
Constructor Details
#initialize ⇒ GitUi
Returns a new instance of GitUi.
7 8 9 |
# File 'lib/wlog/ui/git_ui.rb', line 7 def initialize @strmaker = SysConfig.string_decorator end |
Instance Method Details
#run ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/wlog/ui/git_ui.rb', line 11 def run cmd = "default" until cmd == "end" do cmd = Readline.readline("[#{@strmaker.blue('git')}] ") case cmd when /^set/ path = Readline.readline("Path to git repo (eg: project/.git/): ") unless File.directory? path puts @strmaker.red("That doesn't look like a git repo. Nothing done") next end = Readline.readline("git author: ") # Set the git repo in the db (so one git repo per db) KeyValue.put!("git", path) KeyValue.put!("author", ) when /^unset/ KeyValue.put!("git", "") when /^(ls|show)/ print ' repo: ' puts @strmaker.green(KeyValue.get("git")) print ' auth: ' puts @strmaker.yellow(KeyValue.get("author")) end end end |