Class: WorklogCLI

Inherits:
Thor
  • Object
show all
Includes:
StringHelper
Defined in:
lib/cli.rb

Overview

CLI for the work log application

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from StringHelper

#format_left, #pluralize

Constructor Details

#initialize(args = [], options = {}, config = {}) ⇒ WorklogCLI

Initialize the CLI with the given arguments, options, and configuration



33
34
35
36
37
# File 'lib/cli.rb', line 33

def initialize(args = [], options = {}, config = {})
  @config = Worklog::Configuration.load
  @storage = Worklog::Storage.new(@config)
  super
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



24
25
26
# File 'lib/cli.rb', line 24

def config
  @config
end

#storageObject

Returns the value of attribute storage.



24
25
26
# File 'lib/cli.rb', line 24

def storage
  @storage
end

Class Method Details

.exit_on_failure?Boolean

Set the exit on failure behavior from Thor to true

Returns:

  • (Boolean)


40
41
42
# File 'lib/cli.rb', line 40

def self.exit_on_failure?
  true
end

Instance Method Details

#add(message) ⇒ Object



62
63
64
65
# File 'lib/cli.rb', line 62

def add(message)
  worklog = Worklog::Worklog.new
  worklog.add(message, options)
end

#editObject



69
70
71
72
# File 'lib/cli.rb', line 69

def edit
  worklog = Worklog::Worklog.new
  worklog.edit(options)
end

#githubObject



75
76
77
78
# File 'lib/cli.rb', line 75

def github
  worklog = Worklog::Worklog.new
  worklog.github(options)
end

#initObject



81
82
83
84
# File 'lib/cli.rb', line 81

def init
  worklog = Worklog::Worklog.new
  worklog.init(options)
end

#people(person = nil) ⇒ Object



120
121
122
123
# File 'lib/cli.rb', line 120

def people(person = nil)
  worklog = Worklog::Worklog.new
  worklog.people(person, options)
end

#projectsObject



127
128
129
130
131
132
133
134
135
# File 'lib/cli.rb', line 127

def projects
  worklog = Worklog::Worklog.new

  if options[:oneline]
    worklog.projects_oneline(options)
  else
    worklog.projects(options)
  end
end

#removeObject



88
89
90
91
# File 'lib/cli.rb', line 88

def remove
  worklog = Worklog::Worklog.new
  worklog.remove(options)
end

#serverObject



185
186
187
188
# File 'lib/cli.rb', line 185

def server
  worklog = Worklog::Worklog.new
  worklog.server
end

#showObject



113
114
115
116
# File 'lib/cli.rb', line 113

def show
  worklog = Worklog::Worklog.new
  worklog.show(options)
end

#standupObject



151
152
153
154
# File 'lib/cli.rb', line 151

def standup
  worklog = Worklog::Worklog.new
  worklog.standup(options)
end

#statsObject



191
192
193
194
# File 'lib/cli.rb', line 191

def stats
  worklog = Worklog::Worklog.new
  worklog.stats(options)
end

#summaryObject



207
208
209
210
# File 'lib/cli.rb', line 207

def summary
  worklog = Worklog::Worklog.new
  worklog.summary(options)
end

#tags(tag = nil) ⇒ Object



170
171
172
173
# File 'lib/cli.rb', line 170

def tags(tag = nil)
  worklog = Worklog::Worklog.new
  worklog.tags(tag, options)
end

#takeoutObject



179
180
181
182
# File 'lib/cli.rb', line 179

def takeout
  worklog = Worklog::Worklog.new
  worklog.takeout
end

#versionObject



213
214
215
# File 'lib/cli.rb', line 213

def version
  puts "Worklog #{current_version} running on Ruby #{RUBY_VERSION}"
end