Closed NicksIdeaEngine closed 4 years ago
In todo.txt-cli lingo, action is just the subcommand itself; it does not include any arguments, so I don't see this as a bug, but an enhancement.
Such an enhancement surely could be done (I don't think that actions can include spaces, so there would be no clash or ambiguity), but I'm not convinced of the necessity. Yes, your approach with aliases has the downside that you can't use the same for the default action and custom arguments, but this can be easily achieved with a shell function:
tvp()
{
if [ $# -eq 0 ]; then
todo.sh view project
else
todo.sh "$@"
fi
}
Alternatively, you could also solve this with a custom action, e.g. viewproject
or vp
. Writing custom actions is easy (especially if all they do is calling existing action(s); see here for an example); you just drop then into ~/.todo.action.d/
and can then set that action as your default one.
That makes sense. I appreciate the explanation a lot, and the shell function solution sounds like it'll give me exactly what I'm looking for.
Thank you!
Do you want to request a feature or report a bug?
Feature, but perhaps it's also a bug?
What is the current behavior?
In
config
, settingexport TODOTXT_DEFAULT_ACTION="view project"
to use theview
add-on displays theUsage: todo.sh [-fhpantvV]...
message.Setting the default action to just
"view"
orview
without quotes givesError: Unrecognized option "".
I get the same error setting it toview project
without quotes.If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.
Still not sure if it's a bug, but installing the
view
add-on and trying to set the default action toview project
in any form doesn't work.I did get it somewhat working with this:
alias t="todo.sh -c -d ~/.config/todo/config view project"
But that solution disrupts using
t
for anything other action liket add
ort pri
.What is the expected behavior?
Using
t
to display tasks sorted the wayview project
sorts them, while also being able to uset
for other actions as well. My current workaround is an aliastvp
that has theview project
action, but it'd be cool to just have that as the default without disrupting other actions.Which versions todo.sh are you using?
v2.11.0
Which Operating System are you using?
Ubuntu 19.10
Which version of bash are you using?
zsh 5.7.1 (x86_64-ubuntu-linux-gnu) bash version 5.0.3(1)-release (x86_64-pc-linux-gnu)