mirror of
https://github.com/HKUDS/CLI-Anything.git
synced 2026-08-30 17:34:27 +08:00
fix: add __main__ guard to adguardhome CLI module (#438)
`cli_anything/adguardhome/adguardhome_cli.py` defined `main()` but never invoked it under an `if __name__ == "__main__":` guard, so running the module with `python -m cli_anything.adguardhome.adguardhome_cli` exited 0 without any output. That is the exact module path the `_resolve_cli()` helper in `tests/test_full_e2e.py` falls back to when the console script is not on PATH, so five of the seven subprocess tests failed on a plain checkout while two others — which asserted only the exit code — stayed green. - add the guard to `adguardhome_cli.py` - assert command-specific stdout in `test_rewrite_help` and `test_blocking_help`, matching their sibling tests, so the pair can detect an inert entry point - bump the harness version to 1.0.1 in `setup.py` and `registry.json` Fixes #436 Claude-Session: https://claude.ai/code/session_01ChPxA9ksnNqr83nLbfMhwu Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -674,3 +674,7 @@ def tls_(ctx: click.Context):
|
||||
def tls_status(ctx: click.Context):
|
||||
client = make_client(ctx)
|
||||
output(server_core.get_tls_status(client), ctx.obj["as_json"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
@@ -186,10 +186,12 @@ class TestCLISubprocess:
|
||||
def test_rewrite_help(self):
|
||||
result = self._run(["rewrite", "--help"])
|
||||
assert result.returncode == 0
|
||||
assert "list" in result.stdout
|
||||
|
||||
def test_blocking_help(self):
|
||||
result = self._run(["blocking", "--help"])
|
||||
assert result.returncode == 0
|
||||
assert "parental" in result.stdout
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@@ -2,7 +2,7 @@ from setuptools import setup, find_namespace_packages
|
||||
|
||||
setup(
|
||||
name="cli-anything-adguardhome",
|
||||
version="1.0.0",
|
||||
version="1.0.1",
|
||||
description="CLI harness for AdGuardHome - control your ad blocker from the command line",
|
||||
packages=find_namespace_packages(include=["cli_anything.*"]),
|
||||
install_requires=[
|
||||
|
||||
+1
-1
@@ -122,7 +122,7 @@
|
||||
{
|
||||
"name": "adguardhome",
|
||||
"display_name": "AdGuardHome",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "DNS ad-blocking and network infrastructure management via AdGuardHome REST API",
|
||||
"requires": "AdGuardHome instance running",
|
||||
"homepage": "https://adguard.com/adguard-home/overview.html",
|
||||
|
||||
Reference in New Issue
Block a user