fewald-worklog 0.1.18 → 0.1.20
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.
- checksums.yaml +4 -4
- data/.version +1 -1
- data/worklog/cli.rb +2 -2
- data/worklog/log_entry.rb +1 -1
- data/worklog/printer.rb +2 -0
- data/worklog/worklog.rb +32 -15
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5f2675380f99341c81e753255959cc6d20bbf2ebd32f1f9c4f00134487f212e
|
4
|
+
data.tar.gz: 34e6e9dd7ec2937ad479b9fa3a60a7602d7d4f8a16311bda9a451a1c082e0975
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a1faec55b8533e854f5f0a6069542d3a0af385a933e8540055722723882428df8eb34ac162a9dbc3d0b4f075acfc32642a3d2cf75847441293fec5538a06950
|
7
|
+
data.tar.gz: f7fd71d5d18d59643ea45bc910105a9aca1e55c3be69629aa6037a012ee216d63dfe4cd96b4d6c27ea898a0025746f3ab888b80411a17dd92e9805721cb0e38d
|
data/.version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.20
|
data/worklog/cli.rb
CHANGED
@@ -98,9 +98,9 @@ class WorklogCLI < Thor
|
|
98
98
|
end
|
99
99
|
|
100
100
|
desc 'people', 'Show all people mentioned in the work log'
|
101
|
-
def people
|
101
|
+
def people(person = nil)
|
102
102
|
worklog = Worklog.new
|
103
|
-
worklog.people(options)
|
103
|
+
worklog.people(person, options)
|
104
104
|
end
|
105
105
|
|
106
106
|
desc 'tags', 'Show all tags used in the work log'
|
data/worklog/log_entry.rb
CHANGED
@@ -38,7 +38,7 @@ class LogEntry
|
|
38
38
|
people.each do |person|
|
39
39
|
next unless known_people && known_people[person]
|
40
40
|
|
41
|
-
msg.gsub!(
|
41
|
+
msg.gsub!(/[~@]#{person}/) do |match|
|
42
42
|
s = ''
|
43
43
|
s += ' ' if match[0] == ' '
|
44
44
|
s += "#{Rainbow(known_people[person].name).underline} (~#{person})" if known_people && known_people[person]
|
data/worklog/printer.rb
CHANGED
@@ -6,6 +6,8 @@ require 'rainbow'
|
|
6
6
|
class Printer
|
7
7
|
attr_reader :people
|
8
8
|
|
9
|
+
# Initializes the printer with a list of people.
|
10
|
+
# @param people [Array<Person>] An array of Person objects.
|
9
11
|
def initialize(people = nil)
|
10
12
|
@people = (people || []).to_h { |person| [person.handle, person] }
|
11
13
|
end
|
data/worklog/worklog.rb
CHANGED
@@ -85,25 +85,42 @@ class Worklog
|
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
88
|
-
def people(_options = {})
|
89
|
-
|
90
|
-
|
91
|
-
mentions = {}
|
88
|
+
def people(person = nil, _options = {})
|
89
|
+
all_people = @storage.load_people!
|
90
|
+
people_map = all_people.to_h { |p| [p.handle, p] }
|
92
91
|
all_logs = @storage.all_days
|
93
|
-
all_people = @storage.load_people
|
94
|
-
people_map = all_people.to_h { |person| [person.handle, person] }
|
95
92
|
|
96
|
-
|
97
|
-
|
98
|
-
|
93
|
+
if person
|
94
|
+
person = person.strip
|
95
|
+
unless people_map.key?(person)
|
96
|
+
WorkLogger.error Rainbow("No person found with handle #{person}.").red
|
97
|
+
return
|
98
|
+
end
|
99
|
+
|
100
|
+
printer = Printer.new(all_people)
|
101
|
+
puts "All interactions with #{Rainbow(person).gold}:"
|
102
|
+
all_logs.each do |daily_log|
|
103
|
+
daily_log.entries.each do |entry|
|
104
|
+
printer.print_entry(daily_log, entry, true) if entry.people.include?(person)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
else
|
108
|
+
puts 'People mentioned in the work log:'
|
109
|
+
|
110
|
+
mentions = {}
|
111
|
+
|
112
|
+
all_logs.map(&:people).each do |people|
|
113
|
+
mentions.merge!(people) { |_key, oldval, newval| oldval + newval }
|
114
|
+
end
|
99
115
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
116
|
+
mentions.each do |handle, v|
|
117
|
+
if people_map.key?(handle)
|
118
|
+
print "#{Rainbow(people_map[handle].name).gold} (#{handle})"
|
119
|
+
else
|
120
|
+
print handle
|
121
|
+
end
|
122
|
+
puts ": #{v} #{pluralize(v, 'occurrence')}"
|
105
123
|
end
|
106
|
-
puts ": #{v} #{pluralize(v, 'occurrence')}"
|
107
124
|
end
|
108
125
|
end
|
109
126
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fewald-worklog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Friedrich Ewald
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-04-
|
10
|
+
date: 2025-04-25 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: httparty
|