pypas-cli 0.2.0__tar.gz → 0.2.2__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.
- {pypas_cli-0.2.0 → pypas_cli-0.2.2}/PKG-INFO +1 -1
- {pypas_cli-0.2.0 → pypas_cli-0.2.2}/pyproject.toml +1 -1
- {pypas_cli-0.2.0 → pypas_cli-0.2.2}/src/pypas/lib/config.py +10 -0
- {pypas_cli-0.2.0 → pypas_cli-0.2.2}/src/pypas/main.py +16 -3
- {pypas_cli-0.2.0 → pypas_cli-0.2.2}/src/pypas_cli.egg-info/PKG-INFO +1 -1
- {pypas_cli-0.2.0 → pypas_cli-0.2.2}/LICENSE +0 -0
- {pypas_cli-0.2.0 → pypas_cli-0.2.2}/README.md +0 -0
- {pypas_cli-0.2.0 → pypas_cli-0.2.2}/setup.cfg +0 -0
- {pypas_cli-0.2.0 → pypas_cli-0.2.2}/src/pypas/__init__.py +0 -0
- {pypas_cli-0.2.0 → pypas_cli-0.2.2}/src/pypas/lib/auth.py +0 -0
- {pypas_cli-0.2.0 → pypas_cli-0.2.2}/src/pypas/lib/console.py +0 -0
- {pypas_cli-0.2.0 → pypas_cli-0.2.2}/src/pypas/lib/decorators.py +0 -0
- {pypas_cli-0.2.0 → pypas_cli-0.2.2}/src/pypas/lib/exercise.py +0 -0
- {pypas_cli-0.2.0 → pypas_cli-0.2.2}/src/pypas/lib/monads.py +0 -0
- {pypas_cli-0.2.0 → pypas_cli-0.2.2}/src/pypas/lib/network.py +0 -0
- {pypas_cli-0.2.0 → pypas_cli-0.2.2}/src/pypas/lib/sysutils.py +0 -0
- {pypas_cli-0.2.0 → pypas_cli-0.2.2}/src/pypas/settings.py +0 -0
- {pypas_cli-0.2.0 → pypas_cli-0.2.2}/src/pypas_cli.egg-info/SOURCES.txt +0 -0
- {pypas_cli-0.2.0 → pypas_cli-0.2.2}/src/pypas_cli.egg-info/dependency_links.txt +0 -0
- {pypas_cli-0.2.0 → pypas_cli-0.2.2}/src/pypas_cli.egg-info/entry_points.txt +0 -0
- {pypas_cli-0.2.0 → pypas_cli-0.2.2}/src/pypas_cli.egg-info/requires.txt +0 -0
- {pypas_cli-0.2.0 → pypas_cli-0.2.2}/src/pypas_cli.egg-info/top_level.txt +0 -0
|
@@ -45,3 +45,13 @@ class Config:
|
|
|
45
45
|
@staticmethod
|
|
46
46
|
def unauth():
|
|
47
47
|
settings.MAIN_CONFIG_FILE.unlink(missing_ok=True)
|
|
48
|
+
|
|
49
|
+
@staticmethod
|
|
50
|
+
def find_nested_config(
|
|
51
|
+
config_file: str = settings.EXERCISE_CONFIG_FILE, relative_to_cwd: bool = False
|
|
52
|
+
) -> Path | None:
|
|
53
|
+
base = Path('.').resolve()
|
|
54
|
+
for path in base.rglob(config_file):
|
|
55
|
+
if (p := path.parent) != base:
|
|
56
|
+
return p if not relative_to_cwd else p.relative_to(base)
|
|
57
|
+
return None
|
|
@@ -41,7 +41,13 @@ def get(exercise_slug: str = typer.Argument(help='Slug of exercise')):
|
|
|
41
41
|
)
|
|
42
42
|
if not Confirm.ask('Continue', default=False):
|
|
43
43
|
return
|
|
44
|
-
config
|
|
44
|
+
if (config := Config()).exists():
|
|
45
|
+
console.warning('Current folder seems to be a pypas exercise.')
|
|
46
|
+
console.info(
|
|
47
|
+
'[italic]If continue, files coming from server will [red]MESS[/red] your existing files'
|
|
48
|
+
)
|
|
49
|
+
if not Confirm.ask('Continue', default=False):
|
|
50
|
+
return
|
|
45
51
|
if exercise.download(config.get('token')):
|
|
46
52
|
exercise.unzip()
|
|
47
53
|
console.info(f'Exercise is available at [note]./{exercise.folder}[/note] [success]✔')
|
|
@@ -81,7 +87,7 @@ def auth(token: str = typer.Argument(help='Access token')):
|
|
|
81
87
|
def upgrade():
|
|
82
88
|
"""Upgrade pypas-cli from PyPI."""
|
|
83
89
|
if sysutils.upgrade_pypas():
|
|
84
|
-
print(sysutils.
|
|
90
|
+
print(sysutils.get_package_info())
|
|
85
91
|
else:
|
|
86
92
|
console.error('Error upgrading pypas')
|
|
87
93
|
|
|
@@ -101,9 +107,16 @@ def zip(verbose: bool = typer.Option(False, '--verbose', '-v', help='Increase ve
|
|
|
101
107
|
@inside_exercise
|
|
102
108
|
def put():
|
|
103
109
|
"""Put (upload) exercise."""
|
|
110
|
+
config = Config()
|
|
111
|
+
if nested_config_path := config.find_nested_config(relative_to_cwd=True):
|
|
112
|
+
console.warning(
|
|
113
|
+
f'Another exercise seems to be nested inside current folder: ./{nested_config_path}'
|
|
114
|
+
)
|
|
115
|
+
console.info('[italic]If continue, upload will [red]BREAK[/red] testing[/italic]')
|
|
116
|
+
if not Confirm.ask('Continue', default=False):
|
|
117
|
+
return
|
|
104
118
|
exercise = Exercise.from_config()
|
|
105
119
|
zipfile = exercise.zip(to_tmp_dir=True)
|
|
106
|
-
config = Config()
|
|
107
120
|
exercise.upload(zipfile, config['token'])
|
|
108
121
|
|
|
109
122
|
|
|
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
|