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

How is todo.sh [do] supposed to work? #401

Open
chrysle opened this issue Jan 17, 2023 · 4 comments · May be fixed by #402
Open

How is todo.sh [do] supposed to work? #401

chrysle opened this issue Jan 17, 2023 · 4 comments · May be fixed by #402

Comments

@chrysle
Copy link
Contributor

chrysle commented Jan 17, 2023

Do you want to request a feature or report a bug?

I think a bug.

What is the current behavior?

The todo.sh do command doesn't seem to work as described in the usage.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.

I have done some tests:

user@penguin:~/repos/todo.txt-cli$ ./todo.sh do 1#, 2#
usage: todo.sh do ITEM#[, ITEM#, ITEM#, ...]
user@penguin:~/repos/todo.txt-cli$ ./todo.sh do 1, 2#
1 x 2023-01-17 Important task @github
TODO: 1 marked as done.
usage: todo.sh do ITEM#[, ITEM#, ITEM#, ...]
user@penguin:~/repos/todo.txt-cli$ ./todo.sh do 1 2#
TODO: 1 is already marked done.
usage: todo.sh do ITEM#[, ITEM#, ITEM#, ...]
user@penguin:~/repos/todo.txt-cli$ ./todo.sh do 2 3 #
2 x 2023-01-17 Quite unimportant test task
TODO: 2 marked as done.
3 x 2023-01-17 Quite unimportant test task
TODO: 3 marked as done.
x 2023-01-17 Important task @github
x 2023-01-17 Quite unimportant test task
x 2023-01-17 Quite unimportant test task
TODO: /home/user/todo.txt archived.
user@penguin:~/repos/todo.txt-cli$ ./todo.sh do 4 5#
4 x 2023-01-17 Quite unimportant test task
TODO: 4 marked as done.
usage: todo.sh do ITEM#[, ITEM#, ITEM#, ...]
user@penguin:~/repos/todo.txt-cli$ ./todo.sh do 5 #, 6 #
5 x 2023-01-17 Quite unimportant test task
TODO: 5 marked as done.
x 2023-01-17 Quite unimportant test task
x 2023-01-17 Quite unimportant test task
TODO: /home/user/todo.txt archived.

What is the expected behavior?

As described in the usage.

@inkarkat
Copy link
Member

The ITEM# stands for item number; this may be obvious to native speakers, but it's confusing to others (including me at first). Even worse, the usage help indicates multiple item numbers as a comma-separated list (ITEM#[, ITEM#, ITEM#, ...]), but as shell arguments, these have to be separated by whitespace.

So, in order to do items 11, 42, and 99, you'd issue $ todo.sh do 11 42 99. If you include the #, that's the shell's comment prefix, so anything after that is ignored (unless you escape it or leave out the whitespace in front of it).

I'm all for changing the usage, though I'm a bit unsure what to use for item number (vs. the item text itself (which often is represented as the example THING I NEED TO DO text)).

usage: todo.sh do NR [...]

@chrysle
Copy link
Contributor Author

chrysle commented Jan 17, 2023

I'm all for changing the usage, though I'm a bit unsure what to use for item number (vs. the item text itself (which often is represented as the example THING I NEED TO DO text)).

usage: todo.sh do NR [...]

I'd find this more easily understandable:

usage: todo.sh do NR [NR NR...]

@chrysle
Copy link
Contributor Author

chrysle commented Jan 19, 2023

I think other usage messages including the ITEM# and/or commas, like the one of depri, should also be improved.
Can I open a PR and implement my suggestion?

@inkarkat
Copy link
Member

Yes, sure, go ahead. I agree that this should be done consistently and everywhere.

For the syntax, I'd go with

usage: todo.sh do NR [NR ...]

(So just one repetition of the NR, and a space separating the following ...; incidentally, I've encountered similar syntax today in Python's argparse module, and liked that.

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 a pull request may close this issue.

2 participants