diff --git a/.envrc b/.envrc index 3550a30..cdaaa8c 100644 --- a/.envrc +++ b/.envrc @@ -1 +1 @@ -use flake +use flake .#uv2nix diff --git a/README.md b/README.md index 805f702..2fcf603 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ # streamer Searching for `@tags` in time-based [streams](https://www.cs.yale.edu/homes/freeman/lifestreams.html). + +# Usage + +Running `streamer` finds all lines with @Task \ No newline at end of file diff --git a/flake.nix b/flake.nix index febefcb..4c30117 100644 --- a/flake.nix +++ b/flake.nix @@ -190,9 +190,10 @@ in pkgs.mkShell { - packages = [ + packages = with pkgs; [ virtualenv - pkgs.uv + uv + bashInteractive ]; env = { diff --git a/pyproject.toml b/pyproject.toml index 8120cb9..c54651a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ dependencies = [ ] [project.scripts] -streamer = "streamer:hello" +streamer = "streamer:run" [build-system] requires = ["hatchling"] diff --git a/src/streamer/__init__.py b/src/streamer/__init__.py index bc09abc..e4b23e6 100644 --- a/src/streamer/__init__.py +++ b/src/streamer/__init__.py @@ -1,2 +1,13 @@ -def hello() -> None: - print("You got some stuff to do!") +import glob +import os +cwd = os.getcwd() + +def run() -> None: + for file_name in glob.glob(f"{glob.escape(cwd)}/*.md"): + with open(file_name, "r") as file: + file_content: str = file.read() + + for line_number, line in enumerate(file_content.split("\n"), 1): + if "@Task" in line and "@Done" not in line: + print(line) + print(f" {file_name}:{line_number}")