Class: Wlog::CliInterface
- Inherits:
-
Object
- Object
- Wlog::CliInterface
- Includes:
- StaticConfigurations
- Defined in:
- lib/wlog/ui/cli_interface.rb
Overview
included here, and should be factored out in the future.
Constant Summary
Constants included from StaticConfigurations
StaticConfigurations::AppDirectory, StaticConfigurations::AppName, StaticConfigurations::ConfigDirectory, StaticConfigurations::ConfigFile, StaticConfigurations::DataDirectory, StaticConfigurations::DefaultDb, StaticConfigurations::TaintFile, StaticConfigurations::TemplateDir
Class Method Summary collapse
-
.list_databases ⇒ Object
TODO this might need to be factored out elsewhere.
Instance Method Summary collapse
-
#initialize ⇒ CliInterface
constructor
This is the main entry point of the application.
-
#run ⇒ Object
Run the interface.
Constructor Details
#initialize ⇒ CliInterface
This is the main entry point of the application. Therefore when we init, we want to trigger the table creation stuff.
26 27 28 29 |
# File 'lib/wlog/ui/cli_interface.rb', line 26 def initialize @db = DbRegistry.new(nil) @strmaker = SysConfig.string_decorator end |
Class Method Details
.list_databases ⇒ Object
TODO this might need to be factored out elsewhere
58 59 60 61 62 63 |
# File 'lib/wlog/ui/cli_interface.rb', line 58 def self.list_databases puts "Available Worklog databases: " Dir["#{StaticConfigurations::DataDirectory}*"].each do |db| puts "[%8d bytes] %s" % [File.size(db), db] end end |
Instance Method Details
#run ⇒ Object
Run the interface
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/wlog/ui/cli_interface.rb', line 32 def run cmd = "default" label = @strmaker.white('wlog') until cmd == "end" do cmd = Readline.readline("[#{label}] ") || "end" cmd.chomp! case cmd when /^archive/ then archive cmd when /^showattach/ then show_attach when /^outattach/ then output_attach when /^generateinvoice/ then generate_invoice when /^attach/ then attach when /^focus/ then focus(cmd) when /^new/ then new_issue when /^(ls|show)/ then show_issues when /^outcsv/ then outcsv when /^delete/ then delete_issue(cmd) when /^help/ then print_help when /^search/ then search when /^config/ then config end end end |