psyinfra / onyo

text-based inventory system on top of git
ISC License
3 stars 5 forks source link

`onyo edit` should allow aborting without saving #553

Open aqw opened 4 months ago

aqw commented 4 months ago

Let's say I edit an asset, make a change, but decide I don't want to keep it:

onyo edit accounting/Bingo\ Bob/headphones_apple_airpods.uzl8e1
Effective changes:
--- /home/aqw/git/inm7/onyo demo/accounting/Bingo Bob/headphones_apple_airpods.uzl8e1
+++ /home/aqw/git/inm7/onyo demo/accounting/Bingo Bob/headphones_apple_airpods.uzl8e1
@@ -1,4 +1,4 @@
-type: headphones
+type:
 make: apple
 model: airpods
 serial: uzl8e1
/home/aqw/git/inm7/onyo demo/accounting/Bingo Bob/headphones_apple_airpods.uzl8e1 -> /home/aqw/git/inm7/onyo demo/accounting/Bingo Bob/None_apple_airpods.uzl8e1
Accept changes? (y/n) 

I respond n that I don't want to accept the changes, but then it takes me back into my editor. An "abort" option would be nice, rather than needing to ctrl-C.

Proposed prompt:

Accept changes? (y)es (n)o (a)bort

Or alternatively

Accept changes? (y)es / (e)dit again / (a)bort and discard changes
bpoldrack commented 4 months ago

Agree. Was annoyed by this, too.

bpoldrack commented 3 months ago

https://github.com/psyinfra/onyo/blob/main/onyo/lib/commands.py#L316 suggests a similar but different TODO:

Adding a discard option, that would only affect the current asset. So it's skipping this asset proceeding with the next one instead (if there's any). WDYT, @aqw - is this good enough or would want 4 answers (accept, edit, skip, abort)?

aqw commented 3 months ago

WDYT, @aqw - is this good enough or would want 4 answers (accept, edit, skip, abort)?

I like your 4 answer idea.

TobiasKadelka commented 3 months ago

The most minor thought possible, but just as an alternative word, instead of "(e)dit" I want to propose (c)ontinue editing. "edit" and "e" is the command and the flag of onyo new, so I like using the word "continue" to differenciate :)

TobiasKadelka commented 3 months ago

A lot of people stumbled over the formulation "Cancel command (y) or continue editing asset (n)?" (Ben explained this is done because --yes).

This phrasing should be updated to something more intuitive when reworking the options (accept, edit, skip, abort)