fewald-worklog 0.2.26 → 0.2.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/.version +1 -1
  3. data/lib/cli.rb +8 -2
  4. data/lib/worklog.rb +22 -1
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 36b9165b88874b753ed10bbb1a337626257db5de478fc56c15a475212836879a
4
- data.tar.gz: fe0e5c279c1fb166876892e9642f85761bc6fdbd7d6e24c14b707bd34bd99668
3
+ metadata.gz: b8c94558c15be912d204ae6312864e53c29db6bd8e24cd015f6e9263c202e061
4
+ data.tar.gz: ee2a6c63e4e52af88ba27a92ffc921f5d30f8830d629a1a79e6d4ceef0e88605
5
5
  SHA512:
6
- metadata.gz: 5a9fafe519688f3b9258aa9b5d433dbec01ea6259fc199e3e302791acfb64a3c2159081b4d749ad86b118da0c5fbca990170c9b42dc986ef0e8bf22ec9e81ddf
7
- data.tar.gz: a15669d9d071af3ef4124f0c60de3d41a47fb6c1684b90a523c35cfe53576ef9eca9030bed21f8c2b095279327ed84b6e1bde062beb428225bae888f65fc65f7
6
+ metadata.gz: 5068c669f47c1b7a350bc7c7b83815204797deb107376a3e5920b6a255018bfb852196441e7ab822399ef846f8f669649c9613700440d5b28f6a91345e255971
7
+ data.tar.gz: ec4c265120698d501dd7cd7654af6cc2fb4c80bfb718bcd5860683e8f1df9024f3a60e6d9bec0073491e4cfd1badf46310ef16492cbb59e01c097b225f99202b
data/.version CHANGED
@@ -1 +1 @@
1
- 0.2.26
1
+ 0.2.28
data/lib/cli.rb CHANGED
@@ -105,9 +105,15 @@ class WorklogCLI < Thor
105
105
  end
106
106
 
107
107
  desc 'projects', 'Show all projects defined in the work log'
108
- def projects(options = {})
108
+ option :oneline, type: :boolean, default: false, desc: 'Show only project titles and keys in a single line format'
109
+ def projects
109
110
  worklog = Worklog::Worklog.new
110
- worklog.projects(options)
111
+
112
+ if options[:oneline]
113
+ worklog.projects_oneline(options)
114
+ else
115
+ worklog.projects(options)
116
+ end
111
117
  end
112
118
 
113
119
  desc 'tags', 'Show all tags used in the work log'
data/lib/worklog.rb CHANGED
@@ -76,7 +76,11 @@ module Worklog
76
76
  raise ArgumentError, 'Message cannot be empty' if message.empty?
77
77
 
78
78
  date = Date.strptime(options[:date], '%Y-%m-%d')
79
- time = Time.strptime(options[:time], '%H:%M:%S')
79
+
80
+ # Append seconds to time if not provided
81
+ time = options[:time]
82
+ time += ':00' if options[:time].split(':').size == 2
83
+ time = Time.strptime(time, '%H:%M:%S')
80
84
  @storage.create_file_skeleton(date)
81
85
 
82
86
  # Validate that the project exists if provided
@@ -200,6 +204,23 @@ module Worklog
200
204
  end
201
205
  end
202
206
 
207
+ # Show all projects, one line per project.
208
+ # This is a compact view showing only project names and keys.
209
+ def projects_oneline(_options = {})
210
+ project_storage = ProjectStorage.new(@config)
211
+ projects = project_storage.load_projects
212
+
213
+ # Find longest project name for formatting
214
+ max_len = projects.values.map { |p| p.name.length }.max || 0
215
+
216
+ projects.each_value do |project|
217
+ puts "#{Rainbow(project.name.ljust(max_len)).gold} #{project.key}"
218
+ end
219
+ end
220
+
221
+ # Show all projects with details and recent activity.
222
+ # This method loads all projects and their associated log entries.
223
+ # It also calculates the last activity date for each project based on log entries.
203
224
  def projects(_options = {})
204
225
  project_storage = ProjectStorage.new(@config)
205
226
  projects = project_storage.load_projects
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fewald-worklog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.26
4
+ version: 0.2.28
5
5
  platform: ruby
6
6
  authors:
7
7
  - Friedrich Ewald