Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(amend): append text to the current entry with --append #213

Merged
merged 3 commits into from
Jan 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions source/mite-amend.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ has the required permissions to do it.`,
note: 'optional value to which the time entries note should be set'
}
)
.option(
'--append',
'appends the given text to the currently running entry'
)
.option(
'-e, --editor',
'open preferred $EDITOR for editing'
Expand Down Expand Up @@ -80,6 +84,9 @@ Examples:
If you leave out the id the currently tracked note will be changed
mite amend "created a programmable list of items"

Append a text to the currently running entry (while you’re working on it)
mite amend --apend "added some other stuff"

Change project and service
mite amend 12345678 --service-id 918772 --project-id 129379

Expand Down Expand Up @@ -139,6 +146,13 @@ function inquireNote(updateData, note) {
}

async function getUpdatedTimeEntryData(opts, note, timeEntry) {

// append the given text to the already existing note when there’s one
if (opts.append && note) {
note = [timeEntry.note, note]
.join(timeEntry.note ? ', ' : '');
}

// prepare an object which contains the data for the time entrywhich will
// be updated
let updateData = {
Expand Down