mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
parent
db13bd403f
commit
784ecbbfd9
2 changed files with 12 additions and 6 deletions
|
@ -39,12 +39,6 @@ int CmdTag (
|
||||||
{
|
{
|
||||||
// Gather IDs and TAGs.
|
// Gather IDs and TAGs.
|
||||||
std::set <int> ids = cli.getIds ();
|
std::set <int> ids = cli.getIds ();
|
||||||
|
|
||||||
if (ids.empty ())
|
|
||||||
{
|
|
||||||
throw std::string ("IDs must be specified. See 'timew help tag'.");
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::string> tags = cli.getTags ();
|
std::vector<std::string> tags = cli.getTags ();
|
||||||
|
|
||||||
// Load the data.
|
// Load the data.
|
||||||
|
@ -75,6 +69,11 @@ int CmdTag (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ids.empty ())
|
||||||
|
{
|
||||||
|
throw std::string ("At least one ID must be specified. See 'timew help tag'.");
|
||||||
|
}
|
||||||
|
|
||||||
// Apply tags to ids.
|
// Apply tags to ids.
|
||||||
for (auto& id : ids)
|
for (auto& id : ids)
|
||||||
{
|
{
|
||||||
|
|
|
@ -49,6 +49,13 @@ class TestTag(TestCase):
|
||||||
code, out, err = self.t("tag @1 foo")
|
code, out, err = self.t("tag @1 foo")
|
||||||
self.assertIn('Added foo to @1', out)
|
self.assertIn('Added foo to @1', out)
|
||||||
|
|
||||||
|
|
||||||
|
def test_should_fail_on_missing_id_and_inactive_time_tracking(self):
|
||||||
|
"""Missing id on inactive time tracking is an error"""
|
||||||
|
self.t("track yesterday for 1hour")
|
||||||
|
code, out, err = self.t.runError("tag foo")
|
||||||
|
self.assertIn("At least one ID must be specified.", err)
|
||||||
|
|
||||||
def test_add_tag_to_closed_interval(self):
|
def test_add_tag_to_closed_interval(self):
|
||||||
"""Add a tag to an closed interval"""
|
"""Add a tag to an closed interval"""
|
||||||
self.t("track yesterday for 1hour")
|
self.t("track yesterday for 1hour")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue