obsideo-cli 0.2.1__tar.gz → 0.2.3__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.
- {obsideo_cli-0.2.1 → obsideo_cli-0.2.3}/PKG-INFO +1 -1
- {obsideo_cli-0.2.1 → obsideo_cli-0.2.3}/obsideo/cli.py +5 -5
- {obsideo_cli-0.2.1 → obsideo_cli-0.2.3}/obsideo_cli.egg-info/PKG-INFO +1 -1
- {obsideo_cli-0.2.1 → obsideo_cli-0.2.3}/pyproject.toml +1 -1
- {obsideo_cli-0.2.1 → obsideo_cli-0.2.3}/tests/test_cli.py +77 -77
- {obsideo_cli-0.2.1 → obsideo_cli-0.2.3}/README.md +0 -0
- {obsideo_cli-0.2.1 → obsideo_cli-0.2.3}/obsideo/__init__.py +0 -0
- {obsideo_cli-0.2.1 → obsideo_cli-0.2.3}/obsideo/__main__.py +0 -0
- {obsideo_cli-0.2.1 → obsideo_cli-0.2.3}/obsideo/manifest.py +0 -0
- {obsideo_cli-0.2.1 → obsideo_cli-0.2.3}/obsideo/sync.py +0 -0
- {obsideo_cli-0.2.1 → obsideo_cli-0.2.3}/obsideo_cli.egg-info/SOURCES.txt +0 -0
- {obsideo_cli-0.2.1 → obsideo_cli-0.2.3}/obsideo_cli.egg-info/dependency_links.txt +0 -0
- {obsideo_cli-0.2.1 → obsideo_cli-0.2.3}/obsideo_cli.egg-info/entry_points.txt +0 -0
- {obsideo_cli-0.2.1 → obsideo_cli-0.2.3}/obsideo_cli.egg-info/requires.txt +0 -0
- {obsideo_cli-0.2.1 → obsideo_cli-0.2.3}/obsideo_cli.egg-info/top_level.txt +0 -0
- {obsideo_cli-0.2.1 → obsideo_cli-0.2.3}/obsideo_core/__init__.py +0 -0
- {obsideo_cli-0.2.1 → obsideo_cli-0.2.3}/obsideo_core/config.py +0 -0
- {obsideo_cli-0.2.1 → obsideo_cli-0.2.3}/obsideo_core/crypto.py +0 -0
- {obsideo_cli-0.2.1 → obsideo_cli-0.2.3}/obsideo_core/identity.py +0 -0
- {obsideo_cli-0.2.1 → obsideo_cli-0.2.3}/obsideo_core/login.py +0 -0
- {obsideo_cli-0.2.1 → obsideo_cli-0.2.3}/obsideo_core/names.py +0 -0
- {obsideo_cli-0.2.1 → obsideo_cli-0.2.3}/obsideo_core/storage.py +0 -0
- {obsideo_cli-0.2.1 → obsideo_cli-0.2.3}/setup.cfg +0 -0
- {obsideo_cli-0.2.1 → obsideo_cli-0.2.3}/tests/test_core.py +0 -0
|
@@ -112,7 +112,7 @@ def show_notices() -> None:
|
|
|
112
112
|
_BANNER = r"""
|
|
113
113
|
/\
|
|
114
114
|
/ \ OBSIDEO DRIVE
|
|
115
|
-
\ / encrypted storage we can
|
|
115
|
+
\ / encrypted storage not even we can read
|
|
116
116
|
\/
|
|
117
117
|
"""
|
|
118
118
|
|
|
@@ -178,7 +178,7 @@ def _latest_pypi_version() -> str | None:
|
|
|
178
178
|
f"https://pypi.org/pypi/{config.PACKAGE}/json",
|
|
179
179
|
headers={"User-Agent": config.USER_AGENT},
|
|
180
180
|
)
|
|
181
|
-
with urllib.request.urlopen(req, timeout=
|
|
181
|
+
with urllib.request.urlopen(req, timeout=15, context=config.ssl_context()) as resp:
|
|
182
182
|
return json.loads(resp.read().decode())["info"]["version"]
|
|
183
183
|
except Exception:
|
|
184
184
|
return None
|
|
@@ -206,7 +206,7 @@ def check_for_update() -> None:
|
|
|
206
206
|
print(f"Updating to {latest}...", file=sys.stderr)
|
|
207
207
|
try:
|
|
208
208
|
rc = subprocess.run(
|
|
209
|
-
[sys.executable, "-m", "pip", "install", "-U", config.PACKAGE]
|
|
209
|
+
[sys.executable, "-m", "pip", "install", "-U", "--no-cache-dir", config.PACKAGE]
|
|
210
210
|
).returncode
|
|
211
211
|
except Exception as e:
|
|
212
212
|
print(f"Update failed: {e}\nTry manually: pip install -U {config.PACKAGE}", file=sys.stderr)
|
|
@@ -604,7 +604,7 @@ class ObsideoShell(cmd.Cmd):
|
|
|
604
604
|
# ── exit ──────────────────────────────────────────────────────────────────
|
|
605
605
|
def do_exit(self, arg):
|
|
606
606
|
"""Exit."""
|
|
607
|
-
print("
|
|
607
|
+
print("adios amigo")
|
|
608
608
|
return True
|
|
609
609
|
|
|
610
610
|
do_quit = do_exit
|
|
@@ -684,7 +684,7 @@ def main():
|
|
|
684
684
|
try:
|
|
685
685
|
shell.cmdloop()
|
|
686
686
|
except KeyboardInterrupt:
|
|
687
|
-
print("\
|
|
687
|
+
print("\nadios amigo")
|
|
688
688
|
|
|
689
689
|
|
|
690
690
|
if __name__ == "__main__":
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "obsideo-cli"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.3"
|
|
8
8
|
description = "Obsideo Cloud - encrypted storage we can't read. Save, browse, and sync whatever you want, from your terminal."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -151,80 +151,80 @@ def test_put_folder_into_cwd(shell, tmp_path):
|
|
|
151
151
|
sh.do_cd("backup")
|
|
152
152
|
sh.do_put(str(folder))
|
|
153
153
|
assert "backup/docs/x.txt" in fake.objs
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
# ── Banner + update check (0.2.1) ─────────────────────────────────────────────
|
|
157
|
-
|
|
158
|
-
def test_banner_tty_gated_once(monkeypatch, capsys):
|
|
159
|
-
monkeypatch.setattr(cli.sys.stdout, "isatty", lambda: True, raising=False)
|
|
160
|
-
monkeypatch.delenv("OBSIDEO_NO_BANNER", raising=False)
|
|
161
|
-
monkeypatch.delenv("NO_COLOR", raising=False)
|
|
162
|
-
cli._BANNER_SHOWN = False
|
|
163
|
-
cli.show_banner()
|
|
164
|
-
assert "OBSIDEO DRIVE" in capsys.readouterr().err
|
|
165
|
-
cli.show_banner() # once per process
|
|
166
|
-
assert capsys.readouterr().err == ""
|
|
167
|
-
# non-tty: silent
|
|
168
|
-
monkeypatch.setattr(cli.sys.stdout, "isatty", lambda: False, raising=False)
|
|
169
|
-
cli._BANNER_SHOWN = False
|
|
170
|
-
cli.show_banner()
|
|
171
|
-
assert capsys.readouterr().err == ""
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
def test_parse_version_ordering():
|
|
175
|
-
assert cli._parse_version("0.2.10") > cli._parse_version("0.2.9")
|
|
176
|
-
assert cli._parse_version("0.3.0") > cli._parse_version("0.2.99")
|
|
177
|
-
assert cli._parse_version("0.2.1") == cli._parse_version("0.2.1")
|
|
178
|
-
assert not (cli._parse_version("0.2.0") > cli._parse_version("0.2.1"))
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
def test_update_check_silent_when_not_tty(monkeypatch, capsys):
|
|
182
|
-
monkeypatch.setattr(cli.sys.stdout, "isatty", lambda: False, raising=False)
|
|
183
|
-
called = []
|
|
184
|
-
monkeypatch.setattr(cli, "_latest_pypi_version", lambda: called.append(1) or "9.9.9")
|
|
185
|
-
cli.check_for_update()
|
|
186
|
-
assert capsys.readouterr().err == ""
|
|
187
|
-
assert called == [] # short-circuits before any network call
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
def test_update_check_noop_when_current(monkeypatch, capsys):
|
|
191
|
-
monkeypatch.setattr(cli.sys.stdout, "isatty", lambda: True, raising=False)
|
|
192
|
-
monkeypatch.delenv("OBSIDEO_NO_UPDATE_CHECK", raising=False)
|
|
193
|
-
monkeypatch.setattr(cli.config, "VERSION", "0.2.1")
|
|
194
|
-
monkeypatch.setattr(cli, "_latest_pypi_version", lambda: "0.2.1") # not newer
|
|
195
|
-
asked = []
|
|
196
|
-
monkeypatch.setattr("builtins.input", lambda *a: asked.append(1) or "y")
|
|
197
|
-
cli.check_for_update()
|
|
198
|
-
assert asked == [] # never prompts when already current
|
|
199
|
-
assert "Update available" not in capsys.readouterr().err
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
def test_update_check_prompts_and_respects_no(monkeypatch, capsys):
|
|
203
|
-
monkeypatch.setattr(cli.sys.stdout, "isatty", lambda: True, raising=False)
|
|
204
|
-
monkeypatch.delenv("OBSIDEO_NO_UPDATE_CHECK", raising=False)
|
|
205
|
-
monkeypatch.setattr(cli.config, "VERSION", "0.2.1")
|
|
206
|
-
monkeypatch.setattr(cli, "_latest_pypi_version", lambda: "0.2.2")
|
|
207
|
-
monkeypatch.setattr("builtins.input", lambda *a: "n")
|
|
208
|
-
ran = []
|
|
209
|
-
monkeypatch.setattr(cli.subprocess, "run", lambda *a, **k: ran.append(a))
|
|
210
|
-
cli.check_for_update()
|
|
211
|
-
err = capsys.readouterr().err
|
|
212
|
-
assert "Update available: 0.2.1 -> 0.2.2" in err
|
|
213
|
-
assert ran == [] # declined -> no pip invocation
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
def test_update_check_runs_pip_on_yes(monkeypatch, capsys):
|
|
217
|
-
monkeypatch.setattr(cli.sys.stdout, "isatty", lambda: True, raising=False)
|
|
218
|
-
monkeypatch.delenv("OBSIDEO_NO_UPDATE_CHECK", raising=False)
|
|
219
|
-
monkeypatch.setattr(cli.config, "VERSION", "0.2.1")
|
|
220
|
-
monkeypatch.setattr(cli, "_latest_pypi_version", lambda: "0.2.2")
|
|
221
|
-
monkeypatch.setattr("builtins.input", lambda *a: "y")
|
|
222
|
-
|
|
223
|
-
class _R:
|
|
224
|
-
returncode = 0
|
|
225
|
-
calls = []
|
|
226
|
-
monkeypatch.setattr(cli.subprocess, "run", lambda *a, **k: calls.append(a[0]) or _R())
|
|
227
|
-
with pytest.raises(SystemExit) as e:
|
|
228
|
-
cli.check_for_update()
|
|
229
|
-
assert e.value.code == 0
|
|
230
|
-
assert calls and calls[0][1:] == ["-m", "pip", "install", "-U", "obsideo-cli"]
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
# ── Banner + update check (0.2.1) ─────────────────────────────────────────────
|
|
157
|
+
|
|
158
|
+
def test_banner_tty_gated_once(monkeypatch, capsys):
|
|
159
|
+
monkeypatch.setattr(cli.sys.stdout, "isatty", lambda: True, raising=False)
|
|
160
|
+
monkeypatch.delenv("OBSIDEO_NO_BANNER", raising=False)
|
|
161
|
+
monkeypatch.delenv("NO_COLOR", raising=False)
|
|
162
|
+
cli._BANNER_SHOWN = False
|
|
163
|
+
cli.show_banner()
|
|
164
|
+
assert "OBSIDEO DRIVE" in capsys.readouterr().err
|
|
165
|
+
cli.show_banner() # once per process
|
|
166
|
+
assert capsys.readouterr().err == ""
|
|
167
|
+
# non-tty: silent
|
|
168
|
+
monkeypatch.setattr(cli.sys.stdout, "isatty", lambda: False, raising=False)
|
|
169
|
+
cli._BANNER_SHOWN = False
|
|
170
|
+
cli.show_banner()
|
|
171
|
+
assert capsys.readouterr().err == ""
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
def test_parse_version_ordering():
|
|
175
|
+
assert cli._parse_version("0.2.10") > cli._parse_version("0.2.9")
|
|
176
|
+
assert cli._parse_version("0.3.0") > cli._parse_version("0.2.99")
|
|
177
|
+
assert cli._parse_version("0.2.1") == cli._parse_version("0.2.1")
|
|
178
|
+
assert not (cli._parse_version("0.2.0") > cli._parse_version("0.2.1"))
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
def test_update_check_silent_when_not_tty(monkeypatch, capsys):
|
|
182
|
+
monkeypatch.setattr(cli.sys.stdout, "isatty", lambda: False, raising=False)
|
|
183
|
+
called = []
|
|
184
|
+
monkeypatch.setattr(cli, "_latest_pypi_version", lambda: called.append(1) or "9.9.9")
|
|
185
|
+
cli.check_for_update()
|
|
186
|
+
assert capsys.readouterr().err == ""
|
|
187
|
+
assert called == [] # short-circuits before any network call
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
def test_update_check_noop_when_current(monkeypatch, capsys):
|
|
191
|
+
monkeypatch.setattr(cli.sys.stdout, "isatty", lambda: True, raising=False)
|
|
192
|
+
monkeypatch.delenv("OBSIDEO_NO_UPDATE_CHECK", raising=False)
|
|
193
|
+
monkeypatch.setattr(cli.config, "VERSION", "0.2.1")
|
|
194
|
+
monkeypatch.setattr(cli, "_latest_pypi_version", lambda: "0.2.1") # not newer
|
|
195
|
+
asked = []
|
|
196
|
+
monkeypatch.setattr("builtins.input", lambda *a: asked.append(1) or "y")
|
|
197
|
+
cli.check_for_update()
|
|
198
|
+
assert asked == [] # never prompts when already current
|
|
199
|
+
assert "Update available" not in capsys.readouterr().err
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
def test_update_check_prompts_and_respects_no(monkeypatch, capsys):
|
|
203
|
+
monkeypatch.setattr(cli.sys.stdout, "isatty", lambda: True, raising=False)
|
|
204
|
+
monkeypatch.delenv("OBSIDEO_NO_UPDATE_CHECK", raising=False)
|
|
205
|
+
monkeypatch.setattr(cli.config, "VERSION", "0.2.1")
|
|
206
|
+
monkeypatch.setattr(cli, "_latest_pypi_version", lambda: "0.2.2")
|
|
207
|
+
monkeypatch.setattr("builtins.input", lambda *a: "n")
|
|
208
|
+
ran = []
|
|
209
|
+
monkeypatch.setattr(cli.subprocess, "run", lambda *a, **k: ran.append(a))
|
|
210
|
+
cli.check_for_update()
|
|
211
|
+
err = capsys.readouterr().err
|
|
212
|
+
assert "Update available: 0.2.1 -> 0.2.2" in err
|
|
213
|
+
assert ran == [] # declined -> no pip invocation
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
def test_update_check_runs_pip_on_yes(monkeypatch, capsys):
|
|
217
|
+
monkeypatch.setattr(cli.sys.stdout, "isatty", lambda: True, raising=False)
|
|
218
|
+
monkeypatch.delenv("OBSIDEO_NO_UPDATE_CHECK", raising=False)
|
|
219
|
+
monkeypatch.setattr(cli.config, "VERSION", "0.2.1")
|
|
220
|
+
monkeypatch.setattr(cli, "_latest_pypi_version", lambda: "0.2.2")
|
|
221
|
+
monkeypatch.setattr("builtins.input", lambda *a: "y")
|
|
222
|
+
|
|
223
|
+
class _R:
|
|
224
|
+
returncode = 0
|
|
225
|
+
calls = []
|
|
226
|
+
monkeypatch.setattr(cli.subprocess, "run", lambda *a, **k: calls.append(a[0]) or _R())
|
|
227
|
+
with pytest.raises(SystemExit) as e:
|
|
228
|
+
cli.check_for_update()
|
|
229
|
+
assert e.value.code == 0
|
|
230
|
+
assert calls and calls[0][1:] == ["-m", "pip", "install", "-U", "--no-cache-dir", "obsideo-cli"]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|