Created
March 3, 2019 15:36
-
-
Save hiliev/3fcf62f483efbdc958052ad8d39e0ef8 to your computer and use it in GitHub Desktop.
Modified Timewarrior recipe with simple support for `not` tag filters, e.g., `timew summary -private`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Timewarrior < Formula | |
desc "Command-line time tracking application" | |
homepage "https://taskwarrior.org/docs/timewarrior/" | |
url "https://taskwarrior.org/download/timew-1.1.1.tar.gz" | |
sha256 "1f7d9a62e55fc5a3126433654ccb1fd7d2d135f06f05697f871897c9db77ccc9" | |
head "https://github.com/GothenburgBitFactory/timewarrior.git" | |
patch :DATA | |
bottle do | |
cellar :any_skip_relocation | |
sha256 "48af9bcedd665d7c2541eb3edc9ed14bccf26a1b3861e295b971ed1d8c2cedc6" => :mojave | |
sha256 "add032f6bd1e1b67ff81902522473f6c46e232a097d338b711110a8dea7fc622" => :high_sierra | |
sha256 "79da22a5383fdd5e22eff38ac9deb005c745e78764e1278909b8488cc770dd0d" => :sierra | |
sha256 "71c77b016f36f2aa46d7aa823b9c7dead64f99d6a7458561caa76bb6c8d1c11f" => :el_capitan | |
end | |
depends_on "cmake" => :build | |
def install | |
system "cmake", ".", *std_cmake_args | |
system "make", "install" | |
end | |
test do | |
(testpath/".timewarrior/data").mkpath | |
(testpath/".timewarrior/extensions").mkpath | |
touch testpath/".timewarrior/timewarrior.cfg" | |
assert_match "Tracking foo", shell_output("#{bin}/timew start foo") | |
end | |
end | |
__END__ | |
diff --git a/src/Interval.cpp b/src/Interval.cpp | |
index bc4355d..ea4426a 100644 | |
--- a/src/Interval.cpp | |
+++ b/src/Interval.cpp | |
@@ -92,7 +92,10 @@ bool Interval::empty () const | |
//////////////////////////////////////////////////////////////////////////////// | |
bool Interval::hasTag (const std::string& tag) const | |
{ | |
- return std::find (_tags.begin (), _tags.end (), tag) != _tags.end (); | |
+ if (tag[0] == '-') | |
+ return std::find (_tags.begin (), _tags.end (), tag.substr (1)) == _tags.end (); | |
+ else | |
+ return std::find (_tags.begin (), _tags.end (), tag) != _tags.end (); | |
} | |
//////////////////////////////////////////////////////////////////////////////// |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment