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