viur-cli 2.3.3__tar.gz → 2.3.5__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.
- {viur_cli-2.3.3/src/viur_cli.egg-info → viur_cli-2.3.5}/PKG-INFO +1 -1
- {viur_cli-2.3.3 → viur_cli-2.3.5}/src/viur_cli/scriptor/cli.py +52 -14
- {viur_cli-2.3.3 → viur_cli-2.3.5}/src/viur_cli/version.py +1 -1
- {viur_cli-2.3.3 → viur_cli-2.3.5/src/viur_cli.egg-info}/PKG-INFO +1 -1
- {viur_cli-2.3.3 → viur_cli-2.3.5}/LICENSE +0 -0
- {viur_cli-2.3.3 → viur_cli-2.3.5}/README.md +0 -0
- {viur_cli-2.3.3 → viur_cli-2.3.5}/pyproject.toml +0 -0
- {viur_cli-2.3.3 → viur_cli-2.3.5}/setup.cfg +0 -0
- {viur_cli-2.3.3 → viur_cli-2.3.5}/src/viur_cli/__init__.py +0 -0
- {viur_cli-2.3.3 → viur_cli-2.3.5}/src/viur_cli/build.py +0 -0
- {viur_cli-2.3.3 → viur_cli-2.3.5}/src/viur_cli/cli.py +0 -0
- {viur_cli-2.3.3 → viur_cli-2.3.5}/src/viur_cli/cloud.py +0 -0
- {viur_cli-2.3.3 → viur_cli-2.3.5}/src/viur_cli/conf.py +0 -0
- {viur_cli-2.3.3 → viur_cli-2.3.5}/src/viur_cli/deprecated.py +0 -0
- {viur_cli-2.3.3 → viur_cli-2.3.5}/src/viur_cli/local.py +0 -0
- {viur_cli-2.3.3 → viur_cli-2.3.5}/src/viur_cli/package.py +0 -0
- {viur_cli-2.3.3 → viur_cli-2.3.5}/src/viur_cli/scriptor/__init__.py +0 -0
- {viur_cli-2.3.3 → viur_cli-2.3.5}/src/viur_cli/scriptor/login.py +0 -0
- {viur_cli-2.3.3 → viur_cli-2.3.5}/src/viur_cli/scripts/__init__.py +0 -0
- {viur_cli-2.3.3 → viur_cli-2.3.5}/src/viur_cli/scripts/get_pyodide.py +0 -0
- {viur_cli-2.3.3 → viur_cli-2.3.5}/src/viur_cli/setup.py +0 -0
- {viur_cli-2.3.3 → viur_cli-2.3.5}/src/viur_cli/tool.py +0 -0
- {viur_cli-2.3.3 → viur_cli-2.3.5}/src/viur_cli/update.py +0 -0
- {viur_cli-2.3.3 → viur_cli-2.3.5}/src/viur_cli/utils.py +0 -0
- {viur_cli-2.3.3 → viur_cli-2.3.5}/src/viur_cli.egg-info/SOURCES.txt +0 -0
- {viur_cli-2.3.3 → viur_cli-2.3.5}/src/viur_cli.egg-info/dependency_links.txt +0 -0
- {viur_cli-2.3.3 → viur_cli-2.3.5}/src/viur_cli.egg-info/entry_points.txt +0 -0
- {viur_cli-2.3.3 → viur_cli-2.3.5}/src/viur_cli.egg-info/requires.txt +0 -0
- {viur_cli-2.3.3 → viur_cli-2.3.5}/src/viur_cli.egg-info/top_level.txt +0 -0
|
@@ -4,6 +4,7 @@ import json
|
|
|
4
4
|
import requests
|
|
5
5
|
import os
|
|
6
6
|
import hashlib
|
|
7
|
+
import difflib
|
|
7
8
|
import asyncio
|
|
8
9
|
import sys
|
|
9
10
|
import glob
|
|
@@ -23,7 +24,7 @@ def get_modules():
|
|
|
23
24
|
global _modules
|
|
24
25
|
if _modules is None:
|
|
25
26
|
_modules = Modules(scriptor_config["base_url"], cookies=scriptor_config["cookies"])
|
|
26
|
-
asyncio.
|
|
27
|
+
asyncio.run(_modules.init())
|
|
27
28
|
|
|
28
29
|
return _modules
|
|
29
30
|
|
|
@@ -36,22 +37,39 @@ def script():
|
|
|
36
37
|
|
|
37
38
|
|
|
38
39
|
@script.command()
|
|
39
|
-
@click.option('--url', default=None, help='Set the url')
|
|
40
|
+
@click.option('--url', default=None, help='Set the server url')
|
|
40
41
|
@click.option('--username', default=None, help='Set the username')
|
|
41
42
|
@click.option('--working_dir', default=None, help='Set the working directory where scripts are stored to')
|
|
42
43
|
def configure(url: str, username: str, working_dir: str):
|
|
43
44
|
"""
|
|
44
45
|
Manage configuration settings.
|
|
45
46
|
"""
|
|
47
|
+
if not any([url, username, working_dir]):
|
|
48
|
+
click.echo("No parameters provided. Use one or more of the following options:")
|
|
49
|
+
click.echo(" --url Set the server URL")
|
|
50
|
+
click.echo(" --username Set the username")
|
|
51
|
+
click.echo(" --working_dir Set the working directory where scripts are stored to")
|
|
52
|
+
return
|
|
53
|
+
|
|
54
|
+
changed = []
|
|
46
55
|
|
|
47
56
|
if url:
|
|
48
57
|
scriptor_config["base_url"] = url
|
|
58
|
+
changed.append(f"url = {url}")
|
|
49
59
|
|
|
50
60
|
if username:
|
|
51
61
|
scriptor_config["username"] = username
|
|
62
|
+
changed.append(f"username = {username}")
|
|
52
63
|
|
|
53
64
|
if working_dir:
|
|
54
65
|
scriptor_config["working_dir"] = working_dir.replace("\\", "/")
|
|
66
|
+
changed.append(f"working_dir = {working_dir}")
|
|
67
|
+
|
|
68
|
+
click.echo("Configuration updated:")
|
|
69
|
+
for entry in changed:
|
|
70
|
+
click.echo(f" {entry}")
|
|
71
|
+
|
|
72
|
+
scriptor_config.save()
|
|
55
73
|
|
|
56
74
|
|
|
57
75
|
@script.command()
|
|
@@ -111,7 +129,8 @@ def check_session(ctx: click.Context):
|
|
|
111
129
|
get_modules()
|
|
112
130
|
|
|
113
131
|
@script.command()
|
|
114
|
-
@click.option('--force', default=False,
|
|
132
|
+
@click.option('--force', default=False, is_flag=True,
|
|
133
|
+
help='Overwrite local files without asking for confirmation')
|
|
115
134
|
@click.pass_context
|
|
116
135
|
def pull(ctx: click.Context, force: bool):
|
|
117
136
|
"""
|
|
@@ -126,7 +145,7 @@ def pull(ctx: click.Context, force: bool):
|
|
|
126
145
|
working_dir = scriptor_config.get("working_dir")
|
|
127
146
|
|
|
128
147
|
async def process_entry(entry: dict, is_node: bool):
|
|
129
|
-
_path = os.path.join(working_dir, entry["path"])
|
|
148
|
+
_path = os.path.join(working_dir, entry["path"].lstrip("/"))
|
|
130
149
|
|
|
131
150
|
if is_node:
|
|
132
151
|
if not os.path.exists(_path):
|
|
@@ -144,11 +163,30 @@ def pull(ctx: click.Context, force: bool):
|
|
|
144
163
|
create_file()
|
|
145
164
|
else:
|
|
146
165
|
with open(_path, "r") as f:
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
166
|
+
local_content = f.read()
|
|
167
|
+
remote_content = entry["script"]
|
|
168
|
+
diff = list(difflib.unified_diff(
|
|
169
|
+
remote_content.splitlines(),
|
|
170
|
+
local_content.splitlines(),
|
|
171
|
+
fromfile=f"server/{entry['path'].lstrip('/')}",
|
|
172
|
+
tofile=f"local/{entry['path'].lstrip('/')}",
|
|
173
|
+
lineterm="",
|
|
174
|
+
))
|
|
175
|
+
if diff:
|
|
176
|
+
for line in diff:
|
|
177
|
+
if line.startswith("+++") or line.startswith("---"):
|
|
178
|
+
click.echo(click.style(line, bold=True), nl=True)
|
|
179
|
+
elif line.startswith("@@"):
|
|
180
|
+
click.echo(click.style(line, fg="cyan"), nl=True)
|
|
181
|
+
elif line.startswith("+"):
|
|
182
|
+
click.echo(click.style(line, fg="green"), nl=True)
|
|
183
|
+
elif line.startswith("-"):
|
|
184
|
+
click.echo(click.style(line, fg="red"), nl=True)
|
|
185
|
+
else:
|
|
186
|
+
click.echo(line, nl=True)
|
|
187
|
+
if click.confirm(f"Overwrite local {entry['path']} with remote version?"):
|
|
188
|
+
os.remove(_path)
|
|
189
|
+
create_file()
|
|
152
190
|
|
|
153
191
|
else:
|
|
154
192
|
create_file()
|
|
@@ -161,7 +199,7 @@ def pull(ctx: click.Context, force: bool):
|
|
|
161
199
|
async for leaf in tree.list(skel_type="leaf"):
|
|
162
200
|
await process_entry(leaf, False)
|
|
163
201
|
|
|
164
|
-
asyncio.
|
|
202
|
+
asyncio.run(main())
|
|
165
203
|
|
|
166
204
|
|
|
167
205
|
@script.command()
|
|
@@ -313,7 +351,7 @@ def push(ctx: click.Context, force: bool, watch: bool):
|
|
|
313
351
|
elif os.path.getmtime(event.src_path) == modified_files[event.src_path]:
|
|
314
352
|
return
|
|
315
353
|
modified_files[event.src_path] = os.path.getmtime(event.src_path)
|
|
316
|
-
asyncio.
|
|
354
|
+
asyncio.run(main(event.src_path))
|
|
317
355
|
except Exception as e:
|
|
318
356
|
import traceback
|
|
319
357
|
print(f"Error: on file {event.src_path} {e}")
|
|
@@ -341,9 +379,9 @@ def push(ctx: click.Context, force: bool, watch: bool):
|
|
|
341
379
|
observer.stop()
|
|
342
380
|
observer.join()
|
|
343
381
|
|
|
344
|
-
|
|
382
|
+
watch_loop()
|
|
345
383
|
return
|
|
346
|
-
asyncio.
|
|
384
|
+
asyncio.run(main())
|
|
347
385
|
|
|
348
386
|
|
|
349
387
|
@script.command()
|
|
@@ -376,4 +414,4 @@ def run(ctx: click.Context, path: str, args=None):
|
|
|
376
414
|
|
|
377
415
|
await module.main()
|
|
378
416
|
|
|
379
|
-
asyncio.
|
|
417
|
+
asyncio.run(main())
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
__version__ = "2.3.
|
|
1
|
+
__version__ = "2.3.5"
|
|
2
2
|
MINIMAL_PIPENV = "2023.11.15"
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|