timet 0.8.1 → 0.8.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 85190a5b5ae6c446a96b2dda4c71efbe19ae0a1ec907dd5d699b1d831ecd0cd7
4
- data.tar.gz: ecfd87a600e956b45703fc02865503dd739079f5d8b003770ee9dcb554338903
3
+ metadata.gz: 5eda40ea4aafce60dc6fef1270ca9d013724c45b29ba43e7974b8212f55ac231
4
+ data.tar.gz: b5a45e366bbfdb073ccf32ad545b572faac79f018c3a6f8eac60622aed96b02b
5
5
  SHA512:
6
- metadata.gz: 2866257d4d685e76cbd32874922f7bd837f7a68d59bd152e9575935f63dd98ac1514e5e08a1c019bf661ded1ed409ad6733a235194e996c1d50d4dec9494226c
7
- data.tar.gz: a7e80d8c5e6f1d433b1549f98351721f5b6d28da242062c149cf47289f81ccb8c7808b2a13a3338550770c7594ad26ca4c91862e0da667c7f50259b6a10841cf
6
+ metadata.gz: 0d0cc2dfa64d2af724b2be8543d67f63f5485c4fe81746a29cea29db9b51d1ba5fcf4df98f7cdadb16961f30cd24dff0e65bef93c6f297fe9b61bc9a07b0e15e
7
+ data.tar.gz: fdd6364f4dad16defed0c484eb29adf27479427387be6cd43587bcdbfb628eea2a99a0712c708a5821e50e1064c476b2481cd2efc49cb302d533b0d632c3f08a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.8.2] - 2024-10-02
4
+
5
+ **Improvements:**
6
+ - Added optional field and new_value parameters to the edit command.
7
+ - Updated the edit method logic to prompt for field and new_value if they are not provided.
8
+ - Enhanced test coverage to include scenarios where field and new_value are provided directly and when they are not.
9
+ - Updated the README to reflect the new features of the edit command, including both interactive and direct specification modes.
10
+
11
+ **Additional Considerations:**
12
+ - The changes ensure that the edit command is more versatile and user-friendly, catering to both interactive users and those who prefer scripting or automation.
13
+
3
14
  ## [0.8.1] - 2024-10-02
4
15
  **Bug fixes:**
5
16
  - Fixed a LoadError caused by the byebug gem being required after its removal.
data/README.md CHANGED
@@ -91,7 +91,9 @@ gem install timet
91
91
  ```
92
92
 
93
93
 
94
- - **timet edit**: It allows users update a task's notes, tag, start or end fields.
94
+ - **timet edit**: It allows users to update a task's notes, tag, start, or end fields. Users can either interactively select the field and provide a new value or specify them directly in the command.
95
+
96
+ - **Interactive Mode:**
95
97
  ```bash
96
98
  timet e 1
97
99
  ```
@@ -113,6 +115,26 @@ gem install timet
113
115
  End
114
116
  ```
115
117
 
118
+
119
+ - **Direct Specification Mode:**
120
+ ```bash
121
+ timet e 1 notes "New Meeting Notes"
122
+ ```
123
+
124
+ ```
125
+ Tracked time report [today]:
126
+ +-------+------------+--------+----------+----------+----------+--------------------------+
127
+ | Id | Date | Tag | Start | End | Duration | Notes |
128
+ +-------+------------+--------+----------+----------+----------+--------------------------+
129
+ | 2 | 2024-08-09 | task1 | 16:15:07 | - | 00:00:00 | Meeting with client |
130
+ | 1 | | task1 | 14:55:07 | 15:55:07 | 01:00:00 | New Meeting Note |
131
+ +-------+------------+--------+----------+----------+----------+--------------------------+
132
+ | Total: | 01:00:00 | |
133
+ +-------+------------+--------+----------+----------+----------+--------------------------+
134
+ ```
135
+
136
+
137
+
116
138
  ## Command Reference
117
139
 
118
140
  | Command | Description | Example Usage |
@@ -87,14 +87,18 @@ module Timet
87
87
  end
88
88
  end
89
89
 
90
- desc 'edit (e) [id]', 'edit a task'
91
- def edit(id)
90
+ desc 'edit (e) [id] [field] [value]',
91
+ 'edit a task, [field] (notes, tag, start or end) and [value] are optional parameters'
92
+ def edit(id, field = nil, new_value = nil)
92
93
  item = @db.find_item(id)
93
94
  return puts "No tracked time found for id: #{id}" unless item
94
95
 
95
96
  display_item(item)
96
- field = select_field_to_edit
97
- new_value = prompt_for_new_value(item, field)
97
+ unless FIELD_INDEX.keys.include?(field&.downcase) || new_value
98
+ field = select_field_to_edit
99
+ new_value = prompt_for_new_value(item, field)
100
+ end
101
+
98
102
  validate_and_update(item, field, new_value)
99
103
 
100
104
  summary.display
data/lib/timet/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Timet
4
- VERSION = '0.8.1'
4
+ VERSION = '0.8.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frank Vielma