mantis-cli 21.0.0__tar.gz → 22.0.0__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 (48) hide show
  1. {mantis_cli-21.0.0 → mantis_cli-22.0.0}/PKG-INFO +139 -54
  2. {mantis_cli-21.0.0 → mantis_cli-22.0.0}/README.md +117 -50
  3. mantis_cli-22.0.0/mantis/__init__.py +1 -0
  4. {mantis_cli-21.0.0 → mantis_cli-22.0.0}/mantis/app.py +30 -5
  5. {mantis_cli-21.0.0 → mantis_cli-22.0.0}/mantis/command_line.py +11 -2
  6. {mantis_cli-21.0.0 → mantis_cli-22.0.0}/mantis/commands/__init__.py +6 -4
  7. {mantis_cli-21.0.0 → mantis_cli-22.0.0}/mantis/commands/compose.py +2 -1
  8. mantis_cli-22.0.0/mantis/commands/configuration.py +16 -0
  9. mantis_cli-21.0.0/mantis/commands/config.py → mantis_cli-22.0.0/mantis/commands/connection.py +1 -7
  10. {mantis_cli-21.0.0 → mantis_cli-22.0.0}/mantis/commands/django.py +9 -1
  11. mantis_cli-22.0.0/mantis/commands/secrets.py +77 -0
  12. mantis_cli-22.0.0/mantis/config.py +323 -0
  13. mantis_cli-22.0.0/mantis/extensions/django.py +83 -0
  14. {mantis_cli-21.0.0 → mantis_cli-22.0.0}/mantis/extensions/postgres.py +3 -3
  15. {mantis_cli-21.0.0 → mantis_cli-22.0.0}/mantis/managers.py +116 -46
  16. {mantis_cli-21.0.0 → mantis_cli-22.0.0}/mantis_cli.egg-info/PKG-INFO +140 -55
  17. {mantis_cli-21.0.0 → mantis_cli-22.0.0}/mantis_cli.egg-info/SOURCES.txt +7 -4
  18. {mantis_cli-21.0.0 → mantis_cli-22.0.0}/mantis_cli.egg-info/entry_points.txt +0 -1
  19. mantis_cli-22.0.0/tests/test_config.py +388 -0
  20. mantis_cli-22.0.0/tests/test_managers.py +316 -0
  21. mantis_cli-21.0.0/mantis/__init__.py +0 -1
  22. mantis_cli-21.0.0/mantis/commands/crypto.py +0 -38
  23. mantis_cli-21.0.0/mantis/config.py +0 -192
  24. mantis_cli-21.0.0/mantis/extensions/django.py +0 -35
  25. {mantis_cli-21.0.0 → mantis_cli-22.0.0}/LICENSE +0 -0
  26. {mantis_cli-21.0.0 → mantis_cli-22.0.0}/MANIFEST.in +0 -0
  27. {mantis_cli-21.0.0 → mantis_cli-22.0.0}/mantis/__main__.py +0 -0
  28. {mantis_cli-21.0.0 → mantis_cli-22.0.0}/mantis/commands/containers.py +0 -0
  29. {mantis_cli-21.0.0 → mantis_cli-22.0.0}/mantis/commands/core.py +0 -0
  30. {mantis_cli-21.0.0 → mantis_cli-22.0.0}/mantis/commands/images.py +0 -0
  31. {mantis_cli-21.0.0 → mantis_cli-22.0.0}/mantis/commands/nginx.py +0 -0
  32. {mantis_cli-21.0.0 → mantis_cli-22.0.0}/mantis/commands/postgres.py +0 -0
  33. {mantis_cli-21.0.0 → mantis_cli-22.0.0}/mantis/commands/services.py +0 -0
  34. {mantis_cli-21.0.0 → mantis_cli-22.0.0}/mantis/commands/volumes.py +0 -0
  35. /mantis_cli-21.0.0/mantis/crypto.py → /mantis_cli-22.0.0/mantis/cryptography.py +0 -0
  36. {mantis_cli-21.0.0 → mantis_cli-22.0.0}/mantis/environment.py +0 -0
  37. {mantis_cli-21.0.0 → mantis_cli-22.0.0}/mantis/extensions/__init__.py +0 -0
  38. {mantis_cli-21.0.0 → mantis_cli-22.0.0}/mantis/extensions/nginx.py +0 -0
  39. {mantis_cli-21.0.0 → mantis_cli-22.0.0}/mantis/helpers.py +0 -0
  40. {mantis_cli-21.0.0 → mantis_cli-22.0.0}/mantis/mantis.tpl +0 -0
  41. {mantis_cli-21.0.0 → mantis_cli-22.0.0}/mantis/schema.py +0 -0
  42. {mantis_cli-21.0.0 → mantis_cli-22.0.0}/mantis_cli.egg-info/dependency_links.txt +0 -0
  43. {mantis_cli-21.0.0 → mantis_cli-22.0.0}/mantis_cli.egg-info/requires.txt +0 -0
  44. {mantis_cli-21.0.0 → mantis_cli-22.0.0}/mantis_cli.egg-info/top_level.txt +0 -0
  45. {mantis_cli-21.0.0 → mantis_cli-22.0.0}/setup.cfg +0 -0
  46. {mantis_cli-21.0.0 → mantis_cli-22.0.0}/setup.py +0 -0
  47. {mantis_cli-21.0.0 → mantis_cli-22.0.0}/tests/__init__.py +0 -0
  48. {mantis_cli-21.0.0 → mantis_cli-22.0.0}/tests/test_command_line.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: mantis_cli
3
- Version: 21.0.0
3
+ Version: 22.0.0
4
4
  Summary: Management command to build and deploy webapps, especially based on Django
5
5
  Home-page: https://github.com/PragmaticMates/mantis-cli
6
6
  Author: Erik Telepovský
@@ -9,7 +9,6 @@ Maintainer: Pragmatic Mates
9
9
  Maintainer-email: info@pragmaticmates.com
10
10
  License: GNU General Public License (GPL)
11
11
  Keywords: management deployment docker command
12
- Platform: UNKNOWN
13
12
  Classifier: Programming Language :: Python
14
13
  Classifier: Operating System :: OS Independent
15
14
  Classifier: Environment :: Web Environment
@@ -19,6 +18,26 @@ Classifier: License :: OSI Approved :: GNU General Public License (GPL)
19
18
  Classifier: Development Status :: 5 - Production/Stable
20
19
  Description-Content-Type: text/markdown
21
20
  License-File: LICENSE
21
+ Requires-Dist: cffi
22
+ Requires-Dist: cryptography
23
+ Requires-Dist: pycryptodome
24
+ Requires-Dist: pydantic
25
+ Requires-Dist: PyYAML
26
+ Requires-Dist: rich
27
+ Requires-Dist: typer
28
+ Dynamic: author
29
+ Dynamic: author-email
30
+ Dynamic: classifier
31
+ Dynamic: description
32
+ Dynamic: description-content-type
33
+ Dynamic: home-page
34
+ Dynamic: keywords
35
+ Dynamic: license
36
+ Dynamic: license-file
37
+ Dynamic: maintainer
38
+ Dynamic: maintainer-email
39
+ Dynamic: requires-dist
40
+ Dynamic: summary
22
41
 
23
42
  # mantis-cli
24
43
 
@@ -199,65 +218,131 @@ The environment is also used as an identifier for remote connection.
199
218
 
200
219
  ### Commands
201
220
 
202
- Run `mantis commands` to see all available commands with their descriptions.
203
-
204
- | Command / Shortcut | Description |
205
- |-------------------------------|-------------------------------------------------------------------|
206
- | status / s | Prints images and containers |
207
- | deploy [--dirty] / d | Runs deployment process |
208
- | build [services...] / b | Builds all services with Dockerfiles |
209
- | pull [services...] / p | Pulls required images for services |
210
- | push [services...] / u | Push built images to repository |
211
- | upload | Uploads config, compose and env files to server |
212
- | clean / c | Clean images, containers, networks |
213
- | logs [container] / l | Prints logs of containers |
214
- | networks / n | Prints docker networks |
215
- | healthcheck [container] / hc | Execute health-check of container |
216
- | up [params...] | Calls compose up |
217
- | down [params...] | Calls compose down |
218
- | restart [service] | Restarts all containers |
219
- | stop [containers...] | Stops containers |
220
- | start [containers...] | Starts containers |
221
- | kill [containers...] | Kills containers |
222
- | remove [containers...] | Removes containers |
223
- | bash <container> | Runs bash in container |
224
- | sh <container> | Runs sh in container |
225
- | exec <container> <command> | Executes command in container |
226
- | ssh | Connects to remote host via SSH |
227
- | scale <service> <num> | Scales service to given number |
228
- | zero-downtime [service] | Runs zero-downtime deployment |
229
- | encrypt-env [--force] | Encrypts environment files |
230
- | decrypt-env [--force] | Decrypts environment files |
231
- | check-env | Compares encrypted and decrypted env files |
232
- | generate-key | Creates new encryption key |
233
- | read-key | Returns encryption key value |
234
- | check-config | Validates config file |
235
- | contexts | Prints all docker contexts |
236
- | create-context | Creates docker context |
237
- | services | Lists all defined services |
238
- | commands | Lists all available commands |
221
+ Run `mantis --help` to see all available commands with their descriptions.
222
+
223
+ **Core commands:**
224
+
225
+ | Command / Shortcut | Description |
226
+ |---------------------------------------|-----------------------------------------------------------|
227
+ | status / s | Prints images and containers |
228
+ | deploy [--dirty] [--strategy] / d | Runs deployment process |
229
+ | rolling-update [service] / ru | Performs rolling update of containers one-by-one |
230
+ | clean [params...] / c | Clean images, containers, networks |
231
+
232
+ **Files:**
233
+
234
+ | Command / Shortcut | Description |
235
+ |---------------------------------------|-----------------------------------------------------------|
236
+ | upload / u | Uploads config, compose and env files to server |
237
+
238
+ **Images:**
239
+
240
+ | Command / Shortcut | Description |
241
+ |---------------------------------------|-----------------------------------------------------------|
242
+ | build [SERVICES...] / b | Builds all services with Dockerfiles |
243
+ | pull [SERVICES...] / pl | Pulls required images for services |
244
+ | push [SERVICES...] / p | Push built images to repository |
245
+ | get-image-name SERVICE | Gets image name for service |
246
+
247
+ **Containers:**
248
+
249
+ | Command / Shortcut | Description |
250
+ |---------------------------------------|-----------------------------------------------------------|
251
+ | logs [CONTAINER] / l | Prints logs of containers |
252
+ | networks / n | Prints docker networks |
253
+ | healthcheck [CONTAINER] / hc | Execute health-check of container |
254
+ | stop [CONTAINERS...] | Stops containers |
255
+ | start [CONTAINERS...] | Starts containers |
256
+ | kill [CONTAINERS...] | Kills containers |
257
+ | remove [CONTAINERS...] [--force] | Removes containers |
258
+ | rename CONTAINER NEW_NAME | Rename container |
259
+ | bash CONTAINER | Runs bash in container |
260
+ | sh CONTAINER | Runs sh in container |
261
+ | exec CONTAINER COMMAND... | Executes command in container |
262
+ | exec-it CONTAINER COMMAND... | Executes command in container (interactive) |
263
+ | get-container-name SERVICE | Gets container name for service |
264
+ | remove-suffixes [PREFIX] | Removes numerical suffixes from container names |
265
+
266
+ **Compose:**
267
+
268
+ | Command | Description |
269
+ |---------------------------------------|-----------------------------------------------------------|
270
+ | up [PARAMS...] | Calls compose up |
271
+ | down [PARAMS...] | Calls compose down |
272
+ | run PARAMS... | Calls compose run with params |
273
+
274
+ **Services:**
275
+
276
+ | Command | Description |
277
+ |---------------------------------------|-----------------------------------------------------------|
278
+ | restart [SERVICE] | Restarts containers |
279
+ | scale SERVICE NUM | Scales service to given number |
280
+ | zero-downtime [SERVICE] | Runs zero-downtime deployment |
281
+ | restart-service SERVICE | Restarts a specific service |
282
+ | services | Lists all defined services |
283
+ | services-to-build | Lists services that will be built |
284
+
285
+ **Volumes:**
286
+
287
+ | Command | Description |
288
+ |---------------------------------------|-----------------------------------------------------------|
289
+ | backup-volume VOLUME | Backups volume to a file |
290
+ | restore-volume VOLUME FILE | Restores volume from a file |
291
+
292
+ **Secrets:**
293
+
294
+ | Command | Description |
295
+ |---------------------------------------|-----------------------------------------------------------|
296
+ | show-env [KEYWORD] | Shows environment variables from .env files |
297
+ | encrypt-env [--force] | Encrypts environment files |
298
+ | decrypt-env [--force] | Decrypts environment files |
299
+ | check-env | Compares encrypted and decrypted env files |
300
+ | generate-key | Creates new encryption key |
301
+ | read-key | Returns encryption key value |
302
+
303
+ **Configuration:**
304
+
305
+ | Command | Description |
306
+ |---------------------------------------|-----------------------------------------------------------|
307
+ | show-config | Shows the JSON mantis config |
308
+ | check-config | Validates config file |
309
+
310
+ **Connections:**
311
+
312
+ | Command | Description |
313
+ |---------------------------------------|-----------------------------------------------------------|
314
+ | contexts | Prints all docker contexts |
315
+ | create-context | Creates docker context |
316
+ | ssh | Connects to remote host via SSH |
239
317
 
240
318
  **Django extension:**
241
319
 
242
- | Command | Description |
243
- |-------------------------------|-------------------------------------------------------------------|
244
- | shell | Runs Django shell |
245
- | manage <command> [args...] | Runs Django manage command |
246
- | send-test-email | Sends test email to admins |
320
+ | Command | Description |
321
+ |---------------------------------------|-----------------------------------------------------------|
322
+ | shell | Runs Django shell |
323
+ | manage [OPTIONS] CMD [ARGS...] | Runs Django manage command |
324
+ | send-test-email | Sends test email to admins |
325
+ | reset-migrations | Clears migration history and fakes all migrations |
326
+
327
+ The `manage` command supports health-check options:
328
+ - `--if-healthy`: Only execute if the container is currently healthy. Skips with a warning if not healthy.
329
+ - `--healthy-timeout N`: Wait up to N seconds for the container to become healthy before executing. Polls every second and skips the command if the timeout is reached.
247
330
 
248
331
  **PostgreSQL extension:**
249
332
 
250
- | Command | Description |
251
- |-------------------------------|-------------------------------------------------------------------|
252
- | psql | Starts psql console |
253
- | pg-dump [--data-only] [--table TABLE] | Backups database |
254
- | pg-restore <filename> [--table TABLE] | Restores database from backup |
333
+ | Command | Description |
334
+ |---------------------------------------|-----------------------------------------------------------|
335
+ | psql | Starts psql console |
336
+ | pg-dump [--data-only] [--table] | Backups PostgreSQL database |
337
+ | pg-dump-data [--table] | Backups PostgreSQL database (data only) |
338
+ | pg-restore FILENAME [--table] | Restores database from backup |
339
+ | pg-restore-data FILENAME TABLE | Restores database data from backup |
255
340
 
256
341
  **Nginx extension:**
257
342
 
258
- | Command | Description |
259
- |-------------------------------|-------------------------------------------------------------------|
260
- | reload-webserver | Reloads nginx |
343
+ | Command | Description |
344
+ |---------------------------------------|-----------------------------------------------------------|
345
+ | reload-webserver | Reloads nginx webserver |
261
346
 
262
347
  ### Examples
263
348
 
@@ -274,6 +359,7 @@ mantis -e stage build web api + push + deploy + status
274
359
  # Commands with arguments
275
360
  mantis -e production deploy --dirty
276
361
  mantis -e production manage migrate
362
+ mantis -e production manage --healthy-timeout 60 migrate
277
363
  mantis -e production pg-dump --data-only --table users
278
364
 
279
365
  # Single connection mode (no environment needed)
@@ -395,4 +481,3 @@ Works as follows:
395
481
  ## Release notes
396
482
 
397
483
  Mantis uses semantic versioning. See more in [changelog](https://github.com/PragmaticMates/mantis-cli/blob/master/CHANGES.md).
398
-
@@ -177,65 +177,131 @@ The environment is also used as an identifier for remote connection.
177
177
 
178
178
  ### Commands
179
179
 
180
- Run `mantis commands` to see all available commands with their descriptions.
181
-
182
- | Command / Shortcut | Description |
183
- |-------------------------------|-------------------------------------------------------------------|
184
- | status / s | Prints images and containers |
185
- | deploy [--dirty] / d | Runs deployment process |
186
- | build [services...] / b | Builds all services with Dockerfiles |
187
- | pull [services...] / p | Pulls required images for services |
188
- | push [services...] / u | Push built images to repository |
189
- | upload | Uploads config, compose and env files to server |
190
- | clean / c | Clean images, containers, networks |
191
- | logs [container] / l | Prints logs of containers |
192
- | networks / n | Prints docker networks |
193
- | healthcheck [container] / hc | Execute health-check of container |
194
- | up [params...] | Calls compose up |
195
- | down [params...] | Calls compose down |
196
- | restart [service] | Restarts all containers |
197
- | stop [containers...] | Stops containers |
198
- | start [containers...] | Starts containers |
199
- | kill [containers...] | Kills containers |
200
- | remove [containers...] | Removes containers |
201
- | bash <container> | Runs bash in container |
202
- | sh <container> | Runs sh in container |
203
- | exec <container> <command> | Executes command in container |
204
- | ssh | Connects to remote host via SSH |
205
- | scale <service> <num> | Scales service to given number |
206
- | zero-downtime [service] | Runs zero-downtime deployment |
207
- | encrypt-env [--force] | Encrypts environment files |
208
- | decrypt-env [--force] | Decrypts environment files |
209
- | check-env | Compares encrypted and decrypted env files |
210
- | generate-key | Creates new encryption key |
211
- | read-key | Returns encryption key value |
212
- | check-config | Validates config file |
213
- | contexts | Prints all docker contexts |
214
- | create-context | Creates docker context |
215
- | services | Lists all defined services |
216
- | commands | Lists all available commands |
180
+ Run `mantis --help` to see all available commands with their descriptions.
181
+
182
+ **Core commands:**
183
+
184
+ | Command / Shortcut | Description |
185
+ |---------------------------------------|-----------------------------------------------------------|
186
+ | status / s | Prints images and containers |
187
+ | deploy [--dirty] [--strategy] / d | Runs deployment process |
188
+ | rolling-update [service] / ru | Performs rolling update of containers one-by-one |
189
+ | clean [params...] / c | Clean images, containers, networks |
190
+
191
+ **Files:**
192
+
193
+ | Command / Shortcut | Description |
194
+ |---------------------------------------|-----------------------------------------------------------|
195
+ | upload / u | Uploads config, compose and env files to server |
196
+
197
+ **Images:**
198
+
199
+ | Command / Shortcut | Description |
200
+ |---------------------------------------|-----------------------------------------------------------|
201
+ | build [SERVICES...] / b | Builds all services with Dockerfiles |
202
+ | pull [SERVICES...] / pl | Pulls required images for services |
203
+ | push [SERVICES...] / p | Push built images to repository |
204
+ | get-image-name SERVICE | Gets image name for service |
205
+
206
+ **Containers:**
207
+
208
+ | Command / Shortcut | Description |
209
+ |---------------------------------------|-----------------------------------------------------------|
210
+ | logs [CONTAINER] / l | Prints logs of containers |
211
+ | networks / n | Prints docker networks |
212
+ | healthcheck [CONTAINER] / hc | Execute health-check of container |
213
+ | stop [CONTAINERS...] | Stops containers |
214
+ | start [CONTAINERS...] | Starts containers |
215
+ | kill [CONTAINERS...] | Kills containers |
216
+ | remove [CONTAINERS...] [--force] | Removes containers |
217
+ | rename CONTAINER NEW_NAME | Rename container |
218
+ | bash CONTAINER | Runs bash in container |
219
+ | sh CONTAINER | Runs sh in container |
220
+ | exec CONTAINER COMMAND... | Executes command in container |
221
+ | exec-it CONTAINER COMMAND... | Executes command in container (interactive) |
222
+ | get-container-name SERVICE | Gets container name for service |
223
+ | remove-suffixes [PREFIX] | Removes numerical suffixes from container names |
224
+
225
+ **Compose:**
226
+
227
+ | Command | Description |
228
+ |---------------------------------------|-----------------------------------------------------------|
229
+ | up [PARAMS...] | Calls compose up |
230
+ | down [PARAMS...] | Calls compose down |
231
+ | run PARAMS... | Calls compose run with params |
232
+
233
+ **Services:**
234
+
235
+ | Command | Description |
236
+ |---------------------------------------|-----------------------------------------------------------|
237
+ | restart [SERVICE] | Restarts containers |
238
+ | scale SERVICE NUM | Scales service to given number |
239
+ | zero-downtime [SERVICE] | Runs zero-downtime deployment |
240
+ | restart-service SERVICE | Restarts a specific service |
241
+ | services | Lists all defined services |
242
+ | services-to-build | Lists services that will be built |
243
+
244
+ **Volumes:**
245
+
246
+ | Command | Description |
247
+ |---------------------------------------|-----------------------------------------------------------|
248
+ | backup-volume VOLUME | Backups volume to a file |
249
+ | restore-volume VOLUME FILE | Restores volume from a file |
250
+
251
+ **Secrets:**
252
+
253
+ | Command | Description |
254
+ |---------------------------------------|-----------------------------------------------------------|
255
+ | show-env [KEYWORD] | Shows environment variables from .env files |
256
+ | encrypt-env [--force] | Encrypts environment files |
257
+ | decrypt-env [--force] | Decrypts environment files |
258
+ | check-env | Compares encrypted and decrypted env files |
259
+ | generate-key | Creates new encryption key |
260
+ | read-key | Returns encryption key value |
261
+
262
+ **Configuration:**
263
+
264
+ | Command | Description |
265
+ |---------------------------------------|-----------------------------------------------------------|
266
+ | show-config | Shows the JSON mantis config |
267
+ | check-config | Validates config file |
268
+
269
+ **Connections:**
270
+
271
+ | Command | Description |
272
+ |---------------------------------------|-----------------------------------------------------------|
273
+ | contexts | Prints all docker contexts |
274
+ | create-context | Creates docker context |
275
+ | ssh | Connects to remote host via SSH |
217
276
 
218
277
  **Django extension:**
219
278
 
220
- | Command | Description |
221
- |-------------------------------|-------------------------------------------------------------------|
222
- | shell | Runs Django shell |
223
- | manage <command> [args...] | Runs Django manage command |
224
- | send-test-email | Sends test email to admins |
279
+ | Command | Description |
280
+ |---------------------------------------|-----------------------------------------------------------|
281
+ | shell | Runs Django shell |
282
+ | manage [OPTIONS] CMD [ARGS...] | Runs Django manage command |
283
+ | send-test-email | Sends test email to admins |
284
+ | reset-migrations | Clears migration history and fakes all migrations |
285
+
286
+ The `manage` command supports health-check options:
287
+ - `--if-healthy`: Only execute if the container is currently healthy. Skips with a warning if not healthy.
288
+ - `--healthy-timeout N`: Wait up to N seconds for the container to become healthy before executing. Polls every second and skips the command if the timeout is reached.
225
289
 
226
290
  **PostgreSQL extension:**
227
291
 
228
- | Command | Description |
229
- |-------------------------------|-------------------------------------------------------------------|
230
- | psql | Starts psql console |
231
- | pg-dump [--data-only] [--table TABLE] | Backups database |
232
- | pg-restore <filename> [--table TABLE] | Restores database from backup |
292
+ | Command | Description |
293
+ |---------------------------------------|-----------------------------------------------------------|
294
+ | psql | Starts psql console |
295
+ | pg-dump [--data-only] [--table] | Backups PostgreSQL database |
296
+ | pg-dump-data [--table] | Backups PostgreSQL database (data only) |
297
+ | pg-restore FILENAME [--table] | Restores database from backup |
298
+ | pg-restore-data FILENAME TABLE | Restores database data from backup |
233
299
 
234
300
  **Nginx extension:**
235
301
 
236
- | Command | Description |
237
- |-------------------------------|-------------------------------------------------------------------|
238
- | reload-webserver | Reloads nginx |
302
+ | Command | Description |
303
+ |---------------------------------------|-----------------------------------------------------------|
304
+ | reload-webserver | Reloads nginx webserver |
239
305
 
240
306
  ### Examples
241
307
 
@@ -252,6 +318,7 @@ mantis -e stage build web api + push + deploy + status
252
318
  # Commands with arguments
253
319
  mantis -e production deploy --dirty
254
320
  mantis -e production manage migrate
321
+ mantis -e production manage --healthy-timeout 60 migrate
255
322
  mantis -e production pg-dump --data-only --table users
256
323
 
257
324
  # Single connection mode (no environment needed)
@@ -0,0 +1 @@
1
+ VERSION = '22.0.0'
@@ -18,7 +18,9 @@ EPILOG = """\
18
18
 
19
19
  mantis -e production deploy --dirty
20
20
 
21
- mantis -e production build + push + deploy
21
+ mantis -e production build [yellow]+[/yellow] push [yellow]+[/yellow] deploy
22
+
23
+ mantis -e production build web api [yellow]+[/yellow] push [yellow]+[/yellow] deploy
22
24
 
23
25
  mantis -e prod manage migrate --fake
24
26
 
@@ -49,6 +51,9 @@ app = typer.Typer(
49
51
  # Commands that don't require environment (populated by @no_env_required decorator)
50
52
  NO_ENV_COMMANDS: set[str] = set()
51
53
 
54
+ # Deferred shortcuts (registered after all commands to appear at end of help)
55
+ _DEFERRED_SHORTCUTS: list[tuple] = []
56
+
52
57
  # Cache hostname
53
58
  _hostname = socket.gethostname()
54
59
 
@@ -159,22 +164,28 @@ def command(
159
164
  kwargs['rich_help_panel'] = panel
160
165
  registered = app.command(cmd_name, **kwargs)(wrapper)
161
166
 
162
- # Register shortcut
167
+ # Defer shortcut registration (to appear at end of help)
163
168
  if shortcut:
164
- app.command(shortcut, rich_help_panel="Shortcuts", help=f"Alias for '{cmd_name}'")(wrapper)
169
+ _DEFERRED_SHORTCUTS.append((shortcut, cmd_name, wrapper))
165
170
 
166
171
  return registered
167
172
 
168
173
  return decorator
169
174
 
170
175
 
176
+ def register_shortcuts():
177
+ """Register all deferred shortcuts. Call after all commands are imported."""
178
+ for shortcut, cmd_name, wrapper in _DEFERRED_SHORTCUTS:
179
+ app.command(shortcut, rich_help_panel="Shortcuts", help=f"Alias for '{cmd_name}'")(wrapper)
180
+
181
+
171
182
  def version_callback(value: bool):
172
183
  if value:
173
184
  typer.echo(f"Mantis v{VERSION}")
174
185
  raise typer.Exit()
175
186
 
176
187
 
177
- @app.callback()
188
+ @app.callback(invoke_without_command=True)
178
189
  def main(
179
190
  ctx: typer.Context,
180
191
  environment: Optional[str] = typer.Option(None, "--env", "-e", help="Environment ID"),
@@ -189,6 +200,20 @@ def main(
189
200
  if ctx.resilient_parsing or '--help' in sys.argv or '-h' in sys.argv:
190
201
  return
191
202
 
203
+ # Get all commands being invoked (find non-option arguments after global options)
204
+ commands = []
205
+ skip_next = False
206
+ for arg in sys.argv[1:]:
207
+ if skip_next:
208
+ skip_next = False
209
+ continue
210
+ if arg in ('-e', '--env', '-m', '--mode'):
211
+ skip_next = True
212
+ continue
213
+ if arg.startswith('-') or arg == '+':
214
+ continue
215
+ commands.append(arg)
216
+
192
217
  state._mode = mode
193
218
  state._dry_run = dry_run
194
- state._manager = get_manager(environment, mode, dry_run=dry_run)
219
+ state._manager = get_manager(environment, mode, dry_run=dry_run, commands=commands)
@@ -10,6 +10,10 @@ Examples:
10
10
  mantis -e production deploy --dirty
11
11
  mantis -e production build + push + deploy
12
12
  mantis -e production build web api + push + deploy
13
+ mantis -e prod manage migrate --fake
14
+ mantis -e prod pg-dump --data-only --table users
15
+ mantis -e prod bash web
16
+ mantis -e prod logs django
13
17
  mantis status (single connection mode)
14
18
  mantis manage migrate
15
19
  """
@@ -20,12 +24,15 @@ import click
20
24
  import typer
21
25
 
22
26
  from mantis import VERSION
23
- from mantis.app import app, state
27
+ from mantis.app import app, state, register_shortcuts
24
28
  from mantis.managers import get_manager
25
29
 
26
30
  # Import commands to register them with the app
27
31
  from mantis import commands # noqa: F401
28
32
 
33
+ # Register shortcuts after all commands (so they appear at end of help)
34
+ register_shortcuts()
35
+
29
36
  # Command separator for chaining
30
37
  COMMAND_SEPARATOR = '+'
31
38
 
@@ -174,9 +181,11 @@ def run():
174
181
 
175
182
  # Multiple commands - parse options and initialize state manually
176
183
  opts = parse_global_options(global_opts)
184
+ # Collect all command names from all groups
185
+ all_commands = [group[0] for group in cmd_groups if group]
177
186
  state._mode = opts['mode']
178
187
  state._dry_run = opts['dry_run']
179
- state._manager = get_manager(opts['env'], opts['mode'], dry_run=opts['dry_run'])
188
+ state._manager = get_manager(opts['env'], opts['mode'], dry_run=opts['dry_run'], commands=all_commands)
180
189
 
181
190
  # Get Click app from Typer
182
191
  click_app = typer.main.get_command(app)
@@ -5,8 +5,9 @@ from mantis.commands import (
5
5
  containers,
6
6
  compose,
7
7
  services,
8
- crypto,
9
- config,
8
+ secrets,
9
+ configuration,
10
+ connection,
10
11
  volumes,
11
12
  django,
12
13
  postgres,
@@ -19,8 +20,9 @@ __all__ = [
19
20
  'containers',
20
21
  'compose',
21
22
  'services',
22
- 'crypto',
23
- 'config',
23
+ 'secrets',
24
+ 'configuration',
25
+ 'connection',
24
26
  'volumes',
25
27
  'django',
26
28
  'postgres',
@@ -25,6 +25,7 @@ def down(
25
25
  @command(name="run", panel="Compose")
26
26
  def run_cmd(
27
27
  params: List[str] = typer.Argument(..., help="Compose run parameters"),
28
+ rm: bool = typer.Option(False, "--rm", help="Remove container after run"),
28
29
  ):
29
30
  """Calls compose run with params"""
30
- state.run(params=params)
31
+ state.run(params=params, rm=rm)
@@ -0,0 +1,16 @@
1
+ """Configuration commands: show-config, check-config."""
2
+ import json
3
+
4
+ from mantis.app import command, state
5
+
6
+
7
+ @command(name="show-config", panel="Configuration", no_env=True)
8
+ def show_config():
9
+ """Shows the JSON mantis config"""
10
+ print(json.dumps(state._manager.config, indent=2))
11
+
12
+
13
+ @command(name="check-config", panel="Configuration", no_env=True)
14
+ def check_config():
15
+ """Validates config file"""
16
+ state.check_config()
@@ -1,13 +1,7 @@
1
- """Config commands: check-config, contexts, create-context, ssh."""
1
+ """Connection commands: contexts, create-context, ssh."""
2
2
  from mantis.app import command, state
3
3
 
4
4
 
5
- @command(name="check-config", no_env=True)
6
- def check_config():
7
- """Validates config file"""
8
- state.check_config()
9
-
10
-
11
5
  @command(panel="Connections", no_env=True)
12
6
  def contexts():
13
7
  """Prints all docker contexts"""