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

Add "todo edit --description" for comfy editing in external editor #312

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

hut
Copy link
Contributor

@hut hut commented May 19, 2018

My primary use case of todoman is comfortable editing of descriptions of tasks in a separate editor. The reason is that most data of a task is simple enough to be editable via low-bandwidth interfaces like android clients or thunderbird/lightning. But the description may contain a long text, so the use of a dedicated text editor is warranted.

Currently the same thing can be achieved by running todo edit <taskid>, pressing the arrow key down, then pressing <C-O>. With the option from this PR, all you need is to pass the --description option to the edit command to open the item directly in the editor.

Feel free to change the name of the option. Related issue: #292

@hut
Copy link
Contributor Author

hut commented May 19, 2018

I'm not sure what I should do (or whether i should do anything) about codecov check failure.

@WhyNotHugo
Copy link
Member

Thanks, this looks pretty good. --description sounds slightly odd, but I can't think of anything better, so it's fine by me (@untitaker, any comments?).

Can you please add some tests for that cover this new feature?
Also, please add yourself to AUTHORS and include a CHANGELOG entry (this'd be v3.5.0)

Again, thanks!

@untitaker
Copy link
Member

untitaker commented May 19, 2018 via email

hut added 3 commits May 19, 2018 20:36
This would occur when you quit the editor without saving, since then
click.edit() will return None rather than the text.  Now this case is
properly handled.
When editing the description with `<C-O>` in the UI, the resulting text
is stripped of whitespace.  This should be done too when using
`--description`.
@hut
Copy link
Contributor Author

hut commented May 19, 2018

Is there some recommended way to use todo new --read-description combined with a text editor?

@untitaker
Copy link
Member

untitaker commented May 19, 2018 via email

@hut
Copy link
Contributor Author

hut commented May 23, 2018

I guess it's best to add an option that reads from stdin. While using the text editor directly is probably the most common use case... Once you got another use case, you'd be out of luck.

Q1: The user would be left to implement tons of boilerplate though, reading the info from stdin, calling the editor, etc. Maybe we should provide a wrapper script, if we do it this way?

Q2: I can't find a way to easily fetch the description of a task. todo --porcelain show <taskid> doesn't show it either. It wouldn't break anything if I add the description there, right?

@WhyNotHugo
Copy link
Member

I won't break anything, adding to --portecelain is fine, the only restriction is to avoid deleting or changing stuff there.

Base automatically changed from master to main March 9, 2021 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants