Class: Day::Tracker::Cli

Inherits:
Thor
  • Object
show all
Defined in:
lib/day/tracker.rb

Constant Summary collapse

FILE_PATH =
File.expand_path("~/day-tracker")

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Cli

Returns a new instance of Cli.



8
9
10
11
# File 'lib/day/tracker.rb', line 8

def initialize(*args)
  super
  FileUtils.touch FILE_PATH
end

Instance Method Details

#add(project_name) ⇒ Object



19
20
21
22
23
# File 'lib/day/tracker.rb', line 19

def add(project_name)
	open(FILE_PATH, 'a') do |file|
		file.puts Time.now.strftime("%B %d - #{project_name}")
	end
end

#listObject



14
15
16
# File 'lib/day/tracker.rb', line 14

def list
	puts File.read(FILE_PATH)
end