@champpaba/gslide 0.1.1 → 0.1.3
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.
package/package.json
CHANGED
package/pyproject.toml
CHANGED
package/src/gslide/__init__.py
CHANGED
|
Binary file
|
|
Binary file
|
package/src/gslide/cli.py
CHANGED
|
@@ -13,47 +13,35 @@ def cli() -> None:
|
|
|
13
13
|
|
|
14
14
|
@cli.command()
|
|
15
15
|
def update() -> None:
|
|
16
|
-
"""
|
|
16
|
+
"""Update gslide to the latest version."""
|
|
17
17
|
import subprocess
|
|
18
18
|
|
|
19
19
|
from gslide import __version__
|
|
20
20
|
|
|
21
|
-
click.echo(f"Current
|
|
22
|
-
click.echo("Checking for updates...")
|
|
23
|
-
|
|
24
|
-
try:
|
|
25
|
-
result = subprocess.run(
|
|
26
|
-
["npm", "view", "@champpaba/gslide", "version"],
|
|
27
|
-
capture_output=True,
|
|
28
|
-
text=True,
|
|
29
|
-
timeout=15,
|
|
30
|
-
)
|
|
31
|
-
latest = result.stdout.strip()
|
|
32
|
-
except (subprocess.TimeoutExpired, FileNotFoundError):
|
|
33
|
-
click.echo("Could not check npm registry.", err=True)
|
|
34
|
-
sys.exit(1)
|
|
35
|
-
|
|
36
|
-
if not latest:
|
|
37
|
-
click.echo("Could not determine latest version.", err=True)
|
|
38
|
-
sys.exit(1)
|
|
39
|
-
|
|
40
|
-
if latest == __version__:
|
|
41
|
-
click.echo(f"Already up to date (v{__version__}).")
|
|
42
|
-
return
|
|
43
|
-
|
|
44
|
-
click.echo(f"Latest version: v{latest}")
|
|
21
|
+
click.echo(f"Current: v{__version__}")
|
|
45
22
|
click.echo("Updating...")
|
|
46
23
|
|
|
47
24
|
proc = subprocess.run(
|
|
48
|
-
["npm", "
|
|
25
|
+
["npm", "install", "-g", "@champpaba/gslide@latest"],
|
|
49
26
|
timeout=120,
|
|
50
27
|
)
|
|
51
|
-
if proc.returncode
|
|
52
|
-
click.echo(f"Updated to v{latest}.")
|
|
53
|
-
else:
|
|
28
|
+
if proc.returncode != 0:
|
|
54
29
|
click.echo("Update failed.", err=True)
|
|
55
30
|
sys.exit(1)
|
|
56
31
|
|
|
32
|
+
# Check new version
|
|
33
|
+
result = subprocess.run(
|
|
34
|
+
["node", "-e", "console.log(require(require('path').join(require('child_process').execSync('npm prefix -g').toString().trim(),'lib/node_modules/@champpaba/gslide/package.json')).version)"],
|
|
35
|
+
capture_output=True,
|
|
36
|
+
text=True,
|
|
37
|
+
)
|
|
38
|
+
new_ver = result.stdout.strip() if result.returncode == 0 else "unknown"
|
|
39
|
+
|
|
40
|
+
if new_ver == __version__:
|
|
41
|
+
click.echo(f"Already up to date (v{__version__}).")
|
|
42
|
+
else:
|
|
43
|
+
click.echo(f"Updated: v{__version__} -> v{new_ver}")
|
|
44
|
+
|
|
57
45
|
|
|
58
46
|
# --- Auth commands ---
|
|
59
47
|
|