fewald-worklog 0.2.30 → 0.2.32
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/lib/cli.rb +3 -1
- data/lib/takeout.rb +0 -7
- data/lib/worklog.rb +23 -3
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 14033d83050a174467b6159bc1fdbfb7fd3bc7ffc8883f3b04bc241dec77184b
|
|
4
|
+
data.tar.gz: 7499e124a43649989ffb3010fcb4965f4110ea7efe7d41a8e49515a0d165e022
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 54887531704ca1ef6cc7ef0303d899b991036add0f914f81d55189a67a5b7d2254fc89dff9114cbb7237a394d69fe020dc0175cd0978a56766def700f8bb226d
|
|
7
|
+
data.tar.gz: 1a1207af445e9074d0d66b2802943e71a1a63f7aaaa7ec06f95c10805b3529207acc06ade759a0275bdc675da26ccce6ecdf1200c292bf0817a2a98e6e278975
|
data/.version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.2.
|
|
1
|
+
0.2.32
|
data/lib/cli.rb
CHANGED
|
@@ -49,7 +49,9 @@ class WorklogCLI < Thor
|
|
|
49
49
|
an alphanumeric string.
|
|
50
50
|
LONGDESC
|
|
51
51
|
option :date, type: :string, default: DateTime.now.strftime('%Y-%m-%d'), desc: 'Set the date of the entry'
|
|
52
|
-
option :time, type: :string, default: DateTime.now.strftime('%H:%M:%S'), desc:
|
|
52
|
+
option :time, type: :string, default: DateTime.now.strftime('%H:%M:%S'), desc: <<~DESC
|
|
53
|
+
Set the time of the entry. Can be provided in HHMM, HH:MM, or HH:MM:SS format.
|
|
54
|
+
DESC
|
|
53
55
|
option :tags, type: :array, default: [], desc: 'Add tags to the entry'
|
|
54
56
|
option :ticket, type: :string, desc: 'Ticket number associated with the entry. Can be any alphanumeric string.'
|
|
55
57
|
option :url, type: :string, desc: 'URL to associate with the entry'
|
data/lib/takeout.rb
CHANGED
|
@@ -24,13 +24,6 @@ module Worklog
|
|
|
24
24
|
def to_tar_gz
|
|
25
25
|
tar_io = StringIO.new
|
|
26
26
|
|
|
27
|
-
# Build a mapping of file names to their stats for timestamp preservation
|
|
28
|
-
file_stats = {}
|
|
29
|
-
all_files.each do |file_path|
|
|
30
|
-
file_name = File.basename(file_path)
|
|
31
|
-
file_stats[file_name] = File.stat(file_path)
|
|
32
|
-
end
|
|
33
|
-
|
|
34
27
|
Gem::Package::TarWriter.new(tar_io) do |tar|
|
|
35
28
|
all_files.each do |file_path|
|
|
36
29
|
file_name = File.basename(file_path)
|
data/lib/worklog.rb
CHANGED
|
@@ -80,9 +80,7 @@ module Worklog
|
|
|
80
80
|
date = Date.strptime(options[:date], '%Y-%m-%d')
|
|
81
81
|
|
|
82
82
|
# Append seconds to time if not provided
|
|
83
|
-
time = options[:time]
|
|
84
|
-
time += ':00' if options[:time].split(':').size == 2
|
|
85
|
-
time = Time.strptime(time, '%H:%M:%S')
|
|
83
|
+
time = parse_time_string!(options[:time])
|
|
86
84
|
@storage.create_file_skeleton(date)
|
|
87
85
|
|
|
88
86
|
# Validate that the project exists if provided
|
|
@@ -465,5 +463,27 @@ module Worklog
|
|
|
465
463
|
|
|
466
464
|
raise ProjectNotFoundError, "Project with key '#{project_key}' does not exist."
|
|
467
465
|
end
|
|
466
|
+
|
|
467
|
+
# Parse a time string in HHMM, HH:MM, or HH:MM:SS format.
|
|
468
|
+
# @param time_string [String] the time string to parse
|
|
469
|
+
# @return [Time] the parsed Time object
|
|
470
|
+
def parse_time_string!(time_string)
|
|
471
|
+
# Validate the time string format
|
|
472
|
+
unless time_string.match?(/^\d{1,2}:?\d{2}:?\d{2}?$/)
|
|
473
|
+
raise ArgumentError, 'Invalid time format. Expected HHMM, HH:MM, or HH:MM:SS.'
|
|
474
|
+
end
|
|
475
|
+
|
|
476
|
+
# Prefix with 0 if needed
|
|
477
|
+
time_string = "0#{time_string}" if time_string.length == 3
|
|
478
|
+
|
|
479
|
+
# Split hours and minutes if in HHMM format
|
|
480
|
+
if time_string.length == 4 && time_string.match?(/^\d{4}$/)
|
|
481
|
+
time_string = "#{time_string[0..1]}:#{time_string[2..3]}"
|
|
482
|
+
end
|
|
483
|
+
|
|
484
|
+
# Append seconds to time if not provided
|
|
485
|
+
time_string += ':00' if time_string.split(':').size == 2
|
|
486
|
+
Time.strptime(time_string, '%H:%M:%S')
|
|
487
|
+
end
|
|
468
488
|
end
|
|
469
489
|
end
|