Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add a properties or prop parameter that will list the path to the todo.txt file #47

Closed
wants to merge 1 commit into from

3 participants

@gms8994

This is in preparation for some changes I'm working on within todo.txt-web.

@FND

Couldn't this be implemented as an extension, e.g. similar to edit?

@gms8994

It could, yes; but that would require said extension be installed for everyone who wants to use todo.txt-web in the way I'm working; I'm not opposed to it, but being mainline makes it easier. Is there a way to determine if an extension exists, from the cmdline of todo.sh?

@ginatrapani
Owner

I'm in agreement with @FND here, I can't see a reason why a user would need this functionality, and it feels wrong to build it in so it's available programmatically. If you implement it as an extension, there isn't an easy way to determine if that extension is installed, and it introduces another dependency for todo.txt-web--not ideal.

Why can't todo.txt-web parse the todo config file and determine this info instead?

@FND

that would require said extension be installed for everyone who wants to use
todo.txt-web in the way I'm working

I understand, but that's "just" a matter of dependency handling? (This doesn't
have to be automatic/programmatic; a simple line "NB: requires extension <...>"
in your README might suffice?)

Is there a way to determine if an extension exists, from the cmdline of
todo.sh?

Well, sort of; you could use the respective action's exit status:

t foo && echo "foo present" || echo "foo missing"

However, that depends on whether the action can safely be called without
arguments (of course this assumes proper termination handling by the extension).

@gms8994

Why can't todo.txt-web parse the todo config file and determine this info instead?

Parsing the config file seems hacky at best; there's no direct method to getting at those variables, especially once you include string concatenation, etc.

Well, sort of; you could use the respective action's exit status:

That might work. I'll give that a shot as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 0 deletions.
  1. +8 −0 todo.sh
View
8 todo.sh
@@ -171,6 +171,10 @@ help()
prioritized, replaces current priority with new PRIORITY.
PRIORITY must be an uppercase letter between A and Z.
+ properties
+ prop
+ Lists the path to the todo.txt file
+
replace ITEM# "UPDATED TODO"
Replaces task on line ITEM# with UPDATED TODO.
@@ -1097,6 +1101,10 @@ note: PRIORITY must be anywhere from A to Z."
fi
;;
+"prop" | "properties" )
+ echo $TODO_FILE
+ ;;
+
"replace" )
errmsg="usage: $TODO_SH replace ITEM# \"UPDATED ITEM\""
replaceOrPrepend 'replace' "$@"
Something went wrong with that request. Please try again.