Skip to content

Commit

Permalink
Merge pull request #155 from jwnpoh/readme
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikbraun authored Jul 5, 2021
2 parents 9476953 + eb58c20 commit 65d160e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ timetrace edit project <KEY>
**Flags:**
|Flag|Short|Description|
|-|-|-|
|`--revert`|`-r`|Revert the project to it's state prior to the last edit.|
|`--revert`|`-r`|Revert the project to its state prior to the last edit.|

**Example:**

Expand All @@ -421,7 +421,7 @@ Edit a project called `make-coffee`:
timetrace edit project make-coffee
```

:fire: **New:** Restore the project to it's state prior to the last edit:
:fire: **New:** Restore the project to its state prior to the last edit:

```
timetrace edit project make-coffee --revert
Expand All @@ -447,7 +447,7 @@ timetrace edit record {<KEY>|latest}
|-|-|-|
|`--plus`|`-p`|Add the given duration to the record's end time, e.g. `--plus 1h 10m`|
|`--minus`|`-m`|Subtract the given duration from the record's end time, e.g. `--minus 1h 10m`|
|`--revert`|`-r`|Revert the record to it's state prior to the last edit.|
|`--revert`|`-r`|Revert the record to its state prior to the last edit.|

**Example:**

Expand All @@ -463,7 +463,7 @@ Add 15 minutes to the end of the record created on May 1st, 3PM:
timetrace edit record 2021-05-01-15-00 --plus 15m
```

:fire: **New:** Restore the record to it's state prior to the last edit:
:fire: **New:** Restore the record to its state prior to the last edit:

```
timetrace edit record 2021-05-01-15-00 --revert
Expand Down Expand Up @@ -498,7 +498,7 @@ Delete a project called `make-coffee`:
timetrace delete project make-coffee
```

:fire: **New:** Restore the project to it's pre-deletion state:
:fire: **New:** Restore the project to its pre-deletion state:

```
timetrace delete project make-coffee --revert
Expand Down Expand Up @@ -531,7 +531,7 @@ Delete a record created on May 1st 2021, 3:00 PM:
timetrace delete record 2021-05-01-15-00
```

:fire: **New:** Restore the record to it's pre-deletion state:
:fire: **New:** Restore the record to its pre-deletion state:

```
timetrace delete record 2021-05-01-15-00 --revert
Expand Down
26 changes: 13 additions & 13 deletions cli/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,22 @@ func deleteProjectCommand(t *core.Timetrace) *cobra.Command {
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
key := args[0]

if options.Revert {
if err := t.RevertProject(key); err != nil {
out.Err("Failed to revert project: %s", err.Error())
} else {
out.Info("Project backup restored successfully")
return
}
out.Info("Project backup restored successfully")
return
}

project := core.Project{
Key: key,
}

if !askForConfirmation() {
out.Info("Record NOT deleted.")
if !confirmed && !askForConfirmation() {
out.Info("Project NOT deleted.")
return
}

Expand All @@ -74,7 +75,7 @@ func deleteProjectCommand(t *core.Timetrace) *cobra.Command {
},
}

deleteProject.PersistentFlags().BoolVarP(&options.Revert, "revert", "r", false, "Restores the record to it's state prior to the last 'delete' command.")
deleteProject.PersistentFlags().BoolVarP(&options.Revert, "revert", "r", false, "Restores the record to its state prior to the last 'delete' command.")

return deleteProject
}
Expand All @@ -99,9 +100,9 @@ func deleteRecordCommand(t *core.Timetrace) *cobra.Command {
if options.Revert {
if err := t.RevertRecord(start); err != nil {
out.Err("Failed to revert record: %s", err.Error())
} else {
out.Info("Record backup restored successfully")
return
}
out.Info("Record backup restored successfully")
return
}

Expand All @@ -112,11 +113,10 @@ func deleteRecordCommand(t *core.Timetrace) *cobra.Command {
}

showRecord(record, t.Formatter())
if !confirmed {
if !askForConfirmation() {
out.Info("Record NOT deleted.")
return
}

if !confirmed && !askForConfirmation() {
out.Info("Record NOT deleted.")
return
}

if err := t.BackupRecord(start); err != nil {
Expand All @@ -133,7 +133,7 @@ func deleteRecordCommand(t *core.Timetrace) *cobra.Command {
},
}

deleteRecord.PersistentFlags().BoolVarP(&options.Revert, "revert", "r", false, "Restores the record to it's state prior to the last 'delete' command.")
deleteRecord.PersistentFlags().BoolVarP(&options.Revert, "revert", "r", false, "Restores the record to its state prior to the last 'delete' command.")

return deleteRecord
}
Expand Down

0 comments on commit 65d160e

Please sign in to comment.