timet 0.8.0 → 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: 82f0508cb3ce3bda4db4cd03374c72ac9e9435b1643bdcff0975a8958ccde3e3
4
- data.tar.gz: 57677d041eaee7ec2942c530e7b8540052425654df6eae640576212d4c051395
3
+ metadata.gz: 5eda40ea4aafce60dc6fef1270ca9d013724c45b29ba43e7974b8212f55ac231
4
+ data.tar.gz: b5a45e366bbfdb073ccf32ad545b572faac79f018c3a6f8eac60622aed96b02b
5
5
  SHA512:
6
- metadata.gz: 13cd57244152f85cab48e288107f3915cdb2aa6adb87dd2b80eb0c65a1c5a5900d89e42a72a8ca5f025d035cb88fb0b8ed4c3b5a8ac6849e42ce5001626c2daf
7
- data.tar.gz: e2c2bc33ce046ea62f3589ed4ed51e903bd396aac2a32e590fae37dc20745098a156521801ca8971475c1c853e49ddac834a1e9dba0e419405f345fbd3262de3
6
+ metadata.gz: 0d0cc2dfa64d2af724b2be8543d67f63f5485c4fe81746a29cea29db9b51d1ba5fcf4df98f7cdadb16961f30cd24dff0e65bef93c6f297fe9b61bc9a07b0e15e
7
+ data.tar.gz: fdd6364f4dad16defed0c484eb29adf27479427387be6cd43587bcdbfb628eea2a99a0712c708a5821e50e1064c476b2481cd2efc49cb302d533b0d632c3f08a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
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
+
14
+ ## [0.8.1] - 2024-10-02
15
+ **Bug fixes:**
16
+ - Fixed a LoadError caused by the byebug gem being required after its removal.
17
+
3
18
  ## [0.8.0] - 2024-10-01
4
19
 
5
20
  **Improvements:**
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 |
@@ -6,7 +6,6 @@ require 'tty-prompt'
6
6
  require_relative 'validation_edit_helper'
7
7
  require_relative 'application_helper'
8
8
  require_relative 'time_helper'
9
- require 'byebug'
10
9
 
11
10
  module Timet
12
11
  # Application class that defines CLI commands for time tracking:
@@ -88,14 +87,18 @@ module Timet
88
87
  end
89
88
  end
90
89
 
91
- desc 'edit (e) [id]', 'edit a task'
92
- 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)
93
93
  item = @db.find_item(id)
94
94
  return puts "No tracked time found for id: #{id}" unless item
95
95
 
96
96
  display_item(item)
97
- field = select_field_to_edit
98
- 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
+
99
102
  validate_and_update(item, field, new_value)
100
103
 
101
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.0'
4
+ VERSION = '0.8.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frank Vielma
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-01 00:00:00.000000000 Z
11
+ date: 2024-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor