checkmarks 0.4.0__tar.gz → 0.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. {checkmarks-0.4.0/src/checkmarks.egg-info → checkmarks-0.5.0}/PKG-INFO +3 -1
  2. {checkmarks-0.4.0 → checkmarks-0.5.0}/README.md +2 -0
  3. {checkmarks-0.4.0 → checkmarks-0.5.0}/pyproject.toml +1 -1
  4. {checkmarks-0.4.0 → checkmarks-0.5.0}/src/checkmarks/cli.py +17 -1
  5. {checkmarks-0.4.0 → checkmarks-0.5.0/src/checkmarks.egg-info}/PKG-INFO +3 -1
  6. {checkmarks-0.4.0 → checkmarks-0.5.0}/tests/test_cli.py +24 -0
  7. {checkmarks-0.4.0 → checkmarks-0.5.0}/LICENSE +0 -0
  8. {checkmarks-0.4.0 → checkmarks-0.5.0}/MANIFEST.in +0 -0
  9. {checkmarks-0.4.0 → checkmarks-0.5.0}/setup.cfg +0 -0
  10. {checkmarks-0.4.0 → checkmarks-0.5.0}/src/checkmarks/__init__.py +0 -0
  11. {checkmarks-0.4.0 → checkmarks-0.5.0}/src/checkmarks/collect.py +0 -0
  12. {checkmarks-0.4.0 → checkmarks-0.5.0}/src/checkmarks/parse.py +0 -0
  13. {checkmarks-0.4.0 → checkmarks-0.5.0}/src/checkmarks/render.py +0 -0
  14. {checkmarks-0.4.0 → checkmarks-0.5.0}/src/checkmarks.egg-info/SOURCES.txt +0 -0
  15. {checkmarks-0.4.0 → checkmarks-0.5.0}/src/checkmarks.egg-info/dependency_links.txt +0 -0
  16. {checkmarks-0.4.0 → checkmarks-0.5.0}/src/checkmarks.egg-info/entry_points.txt +0 -0
  17. {checkmarks-0.4.0 → checkmarks-0.5.0}/src/checkmarks.egg-info/top_level.txt +0 -0
  18. {checkmarks-0.4.0 → checkmarks-0.5.0}/tests/fixtures/empty.md +0 -0
  19. {checkmarks-0.4.0 → checkmarks-0.5.0}/tests/fixtures/heading_in_fence.md +0 -0
  20. {checkmarks-0.4.0 → checkmarks-0.5.0}/tests/fixtures/quoted_title.md +0 -0
  21. {checkmarks-0.4.0 → checkmarks-0.5.0}/tests/fixtures/unclosed_frontmatter.md +0 -0
  22. {checkmarks-0.4.0 → checkmarks-0.5.0}/tests/test_collect.py +0 -0
  23. {checkmarks-0.4.0 → checkmarks-0.5.0}/tests/test_parse.py +0 -0
  24. {checkmarks-0.4.0 → checkmarks-0.5.0}/tests/test_render.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: checkmarks
3
- Version: 0.4.0
3
+ Version: 0.5.0
4
4
  Summary: Progress dashboard for Markdown checklists
5
5
  Author-email: menisadi <menisadi@gmail.com>
6
6
  License-Expression: MIT
@@ -141,6 +141,8 @@ Empty files found in folders or read from stdin are hidden; pass `--all` to show
141
141
  |------------------------------|---------------------------------------------|
142
142
  | `-r`, `--recursive` | Descend into subfolders |
143
143
  | `--all` | Show empty files from folders or stdin |
144
+ | `--hide-done` | Hide files that are 100% done |
145
+ | `--sort {title,pct}` | Sort by title (A-Z) or pct (highest first) |
144
146
  | `--format {pretty,tsv,json}` | Choose the output format |
145
147
  | `--json` | Same as `--format json` |
146
148
  | `--no-color` | Disable colour |
@@ -127,6 +127,8 @@ Empty files found in folders or read from stdin are hidden; pass `--all` to show
127
127
  |------------------------------|---------------------------------------------|
128
128
  | `-r`, `--recursive` | Descend into subfolders |
129
129
  | `--all` | Show empty files from folders or stdin |
130
+ | `--hide-done` | Hide files that are 100% done |
131
+ | `--sort {title,pct}` | Sort by title (A-Z) or pct (highest first) |
130
132
  | `--format {pretty,tsv,json}` | Choose the output format |
131
133
  | `--json` | Same as `--format json` |
132
134
  | `--no-color` | Disable colour |
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "checkmarks"
3
- version = "0.4.0"
3
+ version = "0.5.0"
4
4
  description = "Progress dashboard for Markdown checklists"
5
5
  authors = [
6
6
  { name = "menisadi", email = "menisadi@gmail.com" }
@@ -5,7 +5,7 @@ import sys
5
5
 
6
6
  from checkmarks.collect import collect
7
7
  from checkmarks.parse import Item, parse_file
8
- from checkmarks.render import render_json, render_pretty, render_tsv
8
+ from checkmarks.render import pct, render_json, render_pretty, render_tsv
9
9
 
10
10
 
11
11
  def build_parser() -> argparse.ArgumentParser:
@@ -27,6 +27,14 @@ def build_parser() -> argparse.ArgumentParser:
27
27
  action="store_true",
28
28
  help="show empty files found in directories or read from stdin",
29
29
  )
30
+ parser.add_argument(
31
+ "--hide-done", action="store_true", help="hide files that are 100%% done"
32
+ )
33
+ parser.add_argument(
34
+ "--sort",
35
+ choices=["title", "pct"],
36
+ help="sort rows by title (A-Z) or pct (highest first) (default: input order)",
37
+ )
30
38
  fmt = parser.add_mutually_exclusive_group()
31
39
  fmt.add_argument(
32
40
  "--format",
@@ -66,8 +74,16 @@ def main(argv: list[str] | None = None) -> int:
66
74
  warn(f"{item.path}: {item.message}")
67
75
  if item.status == "empty" and not source.explicit and not args.all:
68
76
  continue
77
+ if args.hide_done and item.status == "ok" and item.done == item.total:
78
+ continue
69
79
  items.append(item)
70
80
 
81
+ if args.sort == "title":
82
+ items.sort(key=lambda item: item.title.casefold())
83
+ elif args.sort == "pct":
84
+ # Highest first; rows without a pct (empty, error) go last.
85
+ items.sort(key=lambda item: (pct(item) is None, -(pct(item) or 0)))
86
+
71
87
  is_tty = sys.stdout.isatty()
72
88
  fmt = args.format or ("pretty" if is_tty else "tsv")
73
89
  if fmt == "json":
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: checkmarks
3
- Version: 0.4.0
3
+ Version: 0.5.0
4
4
  Summary: Progress dashboard for Markdown checklists
5
5
  Author-email: menisadi <menisadi@gmail.com>
6
6
  License-Expression: MIT
@@ -141,6 +141,8 @@ Empty files found in folders or read from stdin are hidden; pass `--all` to show
141
141
  |------------------------------|---------------------------------------------|
142
142
  | `-r`, `--recursive` | Descend into subfolders |
143
143
  | `--all` | Show empty files from folders or stdin |
144
+ | `--hide-done` | Hide files that are 100% done |
145
+ | `--sort {title,pct}` | Sort by title (A-Z) or pct (highest first) |
144
146
  | `--format {pretty,tsv,json}` | Choose the output format |
145
147
  | `--json` | Same as `--format json` |
146
148
  | `--no-color` | Disable colour |
@@ -151,3 +151,27 @@ def test_env_dir(
151
151
  monkeypatch.setenv("CHECKMARKS_DIR", str(other))
152
152
  main([])
153
153
  assert capsys.readouterr().out.startswith("Gamma\t")
154
+
155
+
156
+ def test_hide_done(tree: Path, capsys: pytest.CaptureFixture) -> None:
157
+ assert main(["--hide-done", "a.md", "b.md", "notes.md"]) == 0
158
+ titles = [line.split("\t")[0] for line in capsys.readouterr().out.splitlines()]
159
+ assert titles == ["Alpha", "Notes"]
160
+
161
+
162
+ def test_hide_done_exit_1_when_all_done(tree: Path) -> None:
163
+ assert main(["--hide-done", "b.md"]) == 1
164
+
165
+
166
+ def test_sort_title(tree: Path, capsys: pytest.CaptureFixture) -> None:
167
+ (tree / "c.md").write_text("# aardvark\n- [ ] a\n", encoding="utf-8")
168
+ main(["--sort", "title", "b.md", "c.md", "a.md"])
169
+ titles = [line.split("\t")[0] for line in capsys.readouterr().out.splitlines()]
170
+ assert titles == ["aardvark", "Alpha", "Beta"]
171
+
172
+
173
+ def test_sort_pct(tree: Path, capsys: pytest.CaptureFixture) -> None:
174
+ (tree / "c.md").write_text("# Gamma\n- [x] a\n- [ ] b\n", encoding="utf-8")
175
+ main(["--sort", "pct", "bad.md", "notes.md", "a.md", "b.md", "c.md"])
176
+ titles = [line.split("\t")[0] for line in capsys.readouterr().out.splitlines()]
177
+ assert titles == ["Beta", "Alpha", "Gamma", "bad", "Notes"]
File without changes
File without changes
File without changes