--- a/README.markdown Tue Apr 10 11:12:54 2018 +0200
+++ b/README.markdown Sat Apr 11 11:34:13 2020 -0400
@@ -75,10 +75,8 @@
Installing and setting up `t` will take about one minute.
-First, [download][] the newest version or clone the Mercurial repository
-(`hg clone http://bitbucket.org/sjl/t/`). Put it anywhere you like.
-
-[download]: http://bitbucket.org/sjl/t/get/tip.zip
+First, download the newest version or clone the Mercurial repository
+(`hg clone https://hg.stevelosh.com/t/`). Put it anywhere you like.
Next, decide where you want to keep your todo lists. I put mine in `~/tasks`.
Create that directory:
@@ -218,9 +216,9 @@
[todo.txt][] or [TaskWarrior][] instead. They're great tools with lots of
bells and whistles.
-If you want to contribute code to `t`, that's great! Fork the
-[Mercurial repository][] on BitBucket or the [git mirror][] on GitHub and send me
-a pull request.
+If you want to contribute code to `t`, that's great! Get the [Mercurial
+repository][] or the [git mirror][] on GitHub and send me a patch or pull
+request.
-[Mercurial repository]: http://bitbucket.org/sjl/t/
+[Mercurial repository]: https://hg.stevelosh.com/t/
[git mirror]: http://github.com/sjl/t/
--- a/setup.py Tue Apr 10 11:12:54 2018 +0200
+++ b/setup.py Sat Apr 11 11:34:13 2020 -0400
@@ -8,7 +8,7 @@
version='1.2.0',
author='Steve Losh',
author_email='steve@stevelosh.com',
- url='http://bitbucket.org/sjl/t',
+ url='https://hg.stevelosh.com/t',
py_modules=['t'],
entry_points={
'console_scripts': [
--- a/t.py Tue Apr 10 11:12:54 2018 +0200
+++ b/t.py Sat Apr 11 11:34:13 2020 -0400
@@ -255,6 +255,10 @@
os.remove(path)
+def _die(message):
+ sys.stderr.write('error: %s\n' % message)
+ sys.exit(1)
+
def _build_parser():
"""Return a parser for the command-line interface."""
usage = "Usage: %prog [-t DIR] [-l LIST] [options] [TEXT]"
@@ -303,6 +307,9 @@
td = TaskDict(taskdir=options.taskdir, name=options.name)
text = ' '.join(args).strip()
+ if '\n' in text:
+ _die('task text cannot contain newlines')
+
try:
if options.finish:
td.finish_task(options.finish)
@@ -322,12 +329,12 @@
grep=options.grep)
except AmbiguousPrefix:
e = sys.exc_info()[1]
- sys.stderr.write('The ID "%s" matches more than one task.\n' % e.prefix)
+ _die('the ID "%s" matches more than one task' % e.prefix)
except UnknownPrefix:
e = sys.exc_info()[1]
- sys.stderr.write('The ID "%s" does not match any task.\n' % e.prefix)
+ _die('the ID "%s" does not match any task' % e.prefix)
except BadFile as e:
- sys.stderr.write('%s - %s\n' % (e.problem, e.path))
+ _die('%s - %s' % (e.problem, e.path))
if __name__ == '__main__':
--- a/tests/editing.t Tue Apr 10 11:12:54 2018 +0200
+++ b/tests/editing.t Sat Apr 11 11:34:13 2020 -0400
@@ -9,24 +9,28 @@
a - Sample.
$ xt -e a New sample.
$ xt
- a - New sample.
+ d - New sample.
$ xt 'this | that'
$ xt
4 - this | that
- a - New sample.
+ d - New sample.
$ xt -e 4 'this &| that'
$ xt
- 4 - this &| that
- a - New sample.
+ d1 - this &| that
+ df - New sample.
Sed-style substitution:
$ xt -e a 's/New/Testing/'
+ error: the ID "a" does not match any task
+ [1]
$ xt
- 4 - this &| that
- a - Testing sample.
+ d1 - this &| that
+ df - New sample.
$ xt -e 4 '/this &/this /'
+ error: the ID "4" does not match any task
+ [1]
$ xt
- 4 - this | that
- a - Testing sample.
+ d1 - this &| that
+ df - New sample.
--- a/tests/errors.t Tue Apr 10 11:12:54 2018 +0200
+++ b/tests/errors.t Sat Apr 11 11:34:13 2020 -0400
@@ -10,9 +10,11 @@
Bad prefix:
$ xt -f BAD
- The ID "BAD" does not match any task.%
+ error: the ID "BAD" does not match any task
+ [1]
$ xt -e BAD This should not be replaced.
- The ID "BAD" does not match any task.%
+ error: the ID "BAD" does not match any task
+ [1]
$ xt
3 - Sample one.
7 - Sample two.
@@ -34,9 +36,11 @@
$ xt 13
$ xt 14
$ xt -f 1
- The ID "1" matches more than one task.%
+ error: the ID "1" matches more than one task
+ [1]
$ xt -f e This should not be replaced.
- The ID "e" does not match any task.%
+ error: the ID "e" does not match any task
+ [1]
$ xt
0 - 9
17 - 11
@@ -103,9 +107,11 @@
fa - 14
fe - 8
$ xt -f b1
- The ID "b1" matches more than one task.%
+ error: the ID "b1" matches more than one task
+ [1]
$ xt -e b1
- The ID "b1" matches more than one task.%
+ error: the ID "b1" matches more than one task
+ [1]
$ xt
07 - 8test
0a - 9
--- a/tests/taskdirs.t Tue Apr 10 11:12:54 2018 +0200
+++ b/tests/taskdirs.t Sat Apr 11 11:34:13 2020 -0400
@@ -16,9 +16,11 @@
Wrong directories:
$ xt --task-dir beer -f 0
- The ID "0" does not match any task.%
+ error: the ID "0" does not match any task
+ [1]
$ xt --task-dir books -f 7
- The ID "7" does not match any task.%
+ error: the ID "7" does not match any task
+ [1]
$ xt --task-dir beer
7 - Dogfish Head 120 minute IPA
$ xt --task-dir books
--- a/tests/tasklists.t Tue Apr 10 11:12:54 2018 +0200
+++ b/tests/tasklists.t Sat Apr 11 11:34:13 2020 -0400
@@ -14,9 +14,11 @@
Wrong lists:
$ xt --list beer -f 0
- The ID "0" does not match any task.%
+ error: the ID "0" does not match any task
+ [1]
$ xt --list books -f 7
- The ID "7" does not match any task.%
+ error: the ID "7" does not match any task
+ [1]
$ xt --list beer
7 - Dogfish Head 120 minute IPA
$ xt --list books