feat: add self-update command and bump to 2.0.1

- Add `coinhunter update` CLI command for pipx/pip upgrade
- README: document update behavior and recommend pipx install
- Dynamic version badge with cacheSeconds=60
- Version bump: 2.0.0 → 2.0.1

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-16 18:00:43 +08:00
parent 52cd76a750
commit b78845eb43
6 changed files with 71 additions and 5 deletions

View File

@@ -36,3 +36,12 @@ class CLITestCase(unittest.TestCase):
result = cli.main(["market", "tickers", "BTCUSDT"])
self.assertEqual(result, 1)
self.assertIn("error: boom", stderr.getvalue())
def test_update_dispatches(self):
captured = {}
with patch.object(cli, "self_update", return_value={"command": "pipx upgrade coinhunter", "returncode": 0}), patch.object(
cli, "print_json", side_effect=lambda payload: captured.setdefault("payload", payload)
):
result = cli.main(["update"])
self.assertEqual(result, 0)
self.assertEqual(captured["payload"]["returncode"], 0)