feat: tmpo edit & tmpo delete + more formatting options#14
Merged
Conversation
Introduces a new 'edit' command with an interactive UI for editing completed time entries. Adds database methods to fetch projects with completed entries, retrieve completed entries by project, and update time entries. Enhances user experience by allowing selection and modification of entry details with validation and confirmation.
Introduces a new 'delete' command with interactive prompts to select and delete time entries, supporting both current and all projects. Adds DeleteTimeEntry method to the database layer for removing entries by ID. Also fixes the order of flag registration in the edit command initialization.
Introduced ANSI text formatting constants (bold, dim, italic, underline) and corresponding formatting functions. Added combined color and bold formatting functions for success, error, info, and warning messages to enhance UI output flexibility.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Checklist
mainbranch of tmpo.Description
This pull request introduces two new interactive CLI commands,
editanddelete, for managing time entries, and adds supporting database methods and UI formatting utilities. Theeditcommand allows users to interactively modify completed time entries, while thedeletecommand enables interactive deletion of time entries, both with project selection and confirmation prompts. Additionally, the storage layer is extended with new methods for querying and updating entries, and the UI package gains new text formatting helpers.New CLI commands for time entry management:
editcommand (cmd/edit.go) for interactively editing completed time entries, including project selection, entry selection, editing fields with validation and confirmation, and saving changes to the database.deletecommand (cmd/delete.go) for interactively deleting time entries, supporting project selection, entry selection, confirmation, and database deletion.Database/storage enhancements:
GetProjectsWithCompletedEntries,GetCompletedEntriesByProject,UpdateTimeEntry, andDeleteTimeEntrymethods tointernal/storage/db.goto support the new commands. These methods enable filtering projects with completed entries, retrieving/editing/deleting specific entries, and updating entry details.UI and formatting improvements:
internal/ui/ui.gofor improved CLI output styling. [1] [2]Screenshots
tmpo edittmpo delete