viur-cli 2.3.4__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.
Files changed (29) hide show
  1. {viur_cli-2.3.4/src/viur_cli.egg-info → viur_cli-2.3.5}/PKG-INFO +1 -1
  2. {viur_cli-2.3.4 → viur_cli-2.3.5}/src/viur_cli/scriptor/cli.py +45 -10
  3. {viur_cli-2.3.4 → viur_cli-2.3.5}/src/viur_cli/version.py +1 -1
  4. {viur_cli-2.3.4 → viur_cli-2.3.5/src/viur_cli.egg-info}/PKG-INFO +1 -1
  5. {viur_cli-2.3.4 → viur_cli-2.3.5}/LICENSE +0 -0
  6. {viur_cli-2.3.4 → viur_cli-2.3.5}/README.md +0 -0
  7. {viur_cli-2.3.4 → viur_cli-2.3.5}/pyproject.toml +0 -0
  8. {viur_cli-2.3.4 → viur_cli-2.3.5}/setup.cfg +0 -0
  9. {viur_cli-2.3.4 → viur_cli-2.3.5}/src/viur_cli/__init__.py +0 -0
  10. {viur_cli-2.3.4 → viur_cli-2.3.5}/src/viur_cli/build.py +0 -0
  11. {viur_cli-2.3.4 → viur_cli-2.3.5}/src/viur_cli/cli.py +0 -0
  12. {viur_cli-2.3.4 → viur_cli-2.3.5}/src/viur_cli/cloud.py +0 -0
  13. {viur_cli-2.3.4 → viur_cli-2.3.5}/src/viur_cli/conf.py +0 -0
  14. {viur_cli-2.3.4 → viur_cli-2.3.5}/src/viur_cli/deprecated.py +0 -0
  15. {viur_cli-2.3.4 → viur_cli-2.3.5}/src/viur_cli/local.py +0 -0
  16. {viur_cli-2.3.4 → viur_cli-2.3.5}/src/viur_cli/package.py +0 -0
  17. {viur_cli-2.3.4 → viur_cli-2.3.5}/src/viur_cli/scriptor/__init__.py +0 -0
  18. {viur_cli-2.3.4 → viur_cli-2.3.5}/src/viur_cli/scriptor/login.py +0 -0
  19. {viur_cli-2.3.4 → viur_cli-2.3.5}/src/viur_cli/scripts/__init__.py +0 -0
  20. {viur_cli-2.3.4 → viur_cli-2.3.5}/src/viur_cli/scripts/get_pyodide.py +0 -0
  21. {viur_cli-2.3.4 → viur_cli-2.3.5}/src/viur_cli/setup.py +0 -0
  22. {viur_cli-2.3.4 → viur_cli-2.3.5}/src/viur_cli/tool.py +0 -0
  23. {viur_cli-2.3.4 → viur_cli-2.3.5}/src/viur_cli/update.py +0 -0
  24. {viur_cli-2.3.4 → viur_cli-2.3.5}/src/viur_cli/utils.py +0 -0
  25. {viur_cli-2.3.4 → viur_cli-2.3.5}/src/viur_cli.egg-info/SOURCES.txt +0 -0
  26. {viur_cli-2.3.4 → viur_cli-2.3.5}/src/viur_cli.egg-info/dependency_links.txt +0 -0
  27. {viur_cli-2.3.4 → viur_cli-2.3.5}/src/viur_cli.egg-info/entry_points.txt +0 -0
  28. {viur_cli-2.3.4 → viur_cli-2.3.5}/src/viur_cli.egg-info/requires.txt +0 -0
  29. {viur_cli-2.3.4 → viur_cli-2.3.5}/src/viur_cli.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: viur-cli
3
- Version: 2.3.4
3
+ Version: 2.3.5
4
4
  Summary: Command-line interface for ViUR application maintenance.
5
5
  Author-email: "Andreas H. Kelch" <ak@mausbrand.de>
6
6
  License-Expression: MIT
@@ -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
@@ -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, help='Force replace files from server in local working directory')
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
  """
@@ -144,14 +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
- if hashlib.sha256(entry["script"].encode()).digest() \
148
- != hashlib.sha256(f.read().encode()).digest():
149
- try:
150
- if click.confirm(f"There is a difference with {entry['path']}. Overwrite?"):
151
- os.remove(_path)
152
- create_file()
153
- except click.exceptions.Abort:
154
- click.echo("\nSkipping...")
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()
155
190
 
156
191
  else:
157
192
  create_file()
@@ -1,2 +1,2 @@
1
- __version__ = "2.3.4"
1
+ __version__ = "2.3.5"
2
2
  MINIMAL_PIPENV = "2023.11.15"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: viur-cli
3
- Version: 2.3.4
3
+ Version: 2.3.5
4
4
  Summary: Command-line interface for ViUR application maintenance.
5
5
  Author-email: "Andreas H. Kelch" <ak@mausbrand.de>
6
6
  License-Expression: MIT
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