devnomads-cli 0.5.3__tar.gz → 0.5.4__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 (20) hide show
  1. {devnomads_cli-0.5.3 → devnomads_cli-0.5.4}/PKG-INFO +1 -1
  2. {devnomads_cli-0.5.3 → devnomads_cli-0.5.4}/devnomads_cli.egg-info/PKG-INFO +1 -1
  3. {devnomads_cli-0.5.3 → devnomads_cli-0.5.4}/dncli.py +5 -11
  4. {devnomads_cli-0.5.3 → devnomads_cli-0.5.4}/pyproject.toml +1 -1
  5. {devnomads_cli-0.5.3 → devnomads_cli-0.5.4}/tests/test_helpers.py +10 -10
  6. {devnomads_cli-0.5.3 → devnomads_cli-0.5.4}/LICENSE +0 -0
  7. {devnomads_cli-0.5.3 → devnomads_cli-0.5.4}/README.md +0 -0
  8. {devnomads_cli-0.5.3 → devnomads_cli-0.5.4}/devnomads_cli.egg-info/SOURCES.txt +0 -0
  9. {devnomads_cli-0.5.3 → devnomads_cli-0.5.4}/devnomads_cli.egg-info/dependency_links.txt +0 -0
  10. {devnomads_cli-0.5.3 → devnomads_cli-0.5.4}/devnomads_cli.egg-info/entry_points.txt +0 -0
  11. {devnomads_cli-0.5.3 → devnomads_cli-0.5.4}/devnomads_cli.egg-info/requires.txt +0 -0
  12. {devnomads_cli-0.5.3 → devnomads_cli-0.5.4}/devnomads_cli.egg-info/top_level.txt +0 -0
  13. {devnomads_cli-0.5.3 → devnomads_cli-0.5.4}/setup.cfg +0 -0
  14. {devnomads_cli-0.5.3 → devnomads_cli-0.5.4}/tests/test_cert.py +0 -0
  15. {devnomads_cli-0.5.3 → devnomads_cli-0.5.4}/tests/test_cli.py +0 -0
  16. {devnomads_cli-0.5.3 → devnomads_cli-0.5.4}/tests/test_config.py +0 -0
  17. {devnomads_cli-0.5.3 → devnomads_cli-0.5.4}/tests/test_generate.py +0 -0
  18. {devnomads_cli-0.5.3 → devnomads_cli-0.5.4}/tests/test_generated_cli.py +0 -0
  19. {devnomads_cli-0.5.3 → devnomads_cli-0.5.4}/tests/test_hook.py +0 -0
  20. {devnomads_cli-0.5.3 → devnomads_cli-0.5.4}/tests/test_transfer.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: devnomads-cli
3
- Version: 0.5.3
3
+ Version: 0.5.4
4
4
  Summary: Manage your DevNomads services from the command line
5
5
  Author-email: DevNomads <support@devnomads.nl>
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: devnomads-cli
3
- Version: 0.5.3
3
+ Version: 0.5.4
4
4
  Summary: Manage your DevNomads services from the command line
5
5
  Author-email: DevNomads <support@devnomads.nl>
6
6
  License: MIT
@@ -342,14 +342,14 @@ def _render_kv(data: dict[str, Any], title: str | None) -> None:
342
342
  def _auto_columns(rows: list[dict[str, Any]]) -> list[str]:
343
343
  """Choose the columns worth showing in a list view, from the data itself.
344
344
 
345
- Three things get dropped, because a list is an overview and the full record
345
+ Two things get dropped, because a list is an overview and the full record
346
346
  is always available via the matching ``show`` command (or ``-o json``):
347
347
 
348
348
  * columns empty in every row (no information at all);
349
349
  * columns holding a list of objects (instances, mailboxes, ips, ...) -
350
- these are detail, belonging in the ``show`` view, not the overview;
351
- * columns whose value never changes across rows - they cost width without
352
- helping tell the rows apart (the first column is kept as an anchor).
350
+ these are detail, belonging in the ``show`` view, not the overview.
351
+
352
+ Every other field is kept, even if its value is the same on every row.
353
353
  """
354
354
 
355
355
  cols: list[str] = []
@@ -370,17 +370,11 @@ def _auto_columns(rows: list[dict[str, Any]]) -> list[str]:
370
370
  for row in rows
371
371
  )
372
372
 
373
- cols = [
373
+ return [
374
374
  c
375
375
  for c in cols
376
376
  if any(not empty(row.get(c)) for row in rows) and not is_object_list(c)
377
377
  ]
378
- if len(rows) > 1 and cols:
379
- anchor = cols[0]
380
- rendered = {c: {_cell(row.get(c)) for row in rows} for c in cols}
381
- if any(len(values) > 1 for values in rendered.values()):
382
- cols = [c for c in cols if c == anchor or len(rendered[c]) > 1]
383
- return cols
384
378
 
385
379
 
386
380
  def _render_rows(
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "devnomads-cli"
3
- version = "0.5.3"
3
+ version = "0.5.4"
4
4
  description = "Manage your DevNomads services from the command line"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -231,25 +231,25 @@ def test_cell_detail_keeps_per_item_lines():
231
231
  assert _cell(insts) == "id=7 state_last_known=running"
232
232
 
233
233
 
234
- def test_auto_columns_drops_empty_constant_and_object_lists():
234
+ def test_auto_columns_drops_empty_and_object_lists_only():
235
235
  rows = [
236
236
  {"id": 1, "port": 80, "registry": "same", "blank": "", "instances": [{"i": 7}]},
237
237
  {"id": 2, "port": 81, "registry": "same", "blank": "", "instances": [{"i": 8}]},
238
238
  ]
239
- # registry is constant, blank is empty, instances is an object list -> all
240
- # dropped; id (anchor) and port (varies) remain.
241
- assert _auto_columns(rows) == ["id", "port"]
239
+ # blank is empty and instances is an object list -> dropped; every other
240
+ # scalar is kept, including the constant `registry`.
241
+ assert _auto_columns(rows) == ["id", "port", "registry"]
242
242
 
243
243
 
244
- def test_auto_columns_keeps_anchor_even_if_constant():
244
+ def test_auto_columns_keeps_constant_scalar_columns():
245
245
  rows = [{"id": 1, "x": 9, "y": "a"}, {"id": 1, "x": 9, "y": "b"}]
246
- # x is constant -> dropped; id is constant but the anchor -> kept
247
- assert _auto_columns(rows) == ["id", "y"]
246
+ # constant columns are no longer dropped - normal fields always show
247
+ assert _auto_columns(rows) == ["id", "x", "y"]
248
248
 
249
249
 
250
250
  def test_auto_columns_single_row_keeps_nonempty_scalars():
251
251
  rows = [{"id": 1, "name": "x", "blank": None, "items": [{"a": 1}]}]
252
- # one row: no constant-drop, but empty and object-list columns still go
252
+ # empty and object-list columns go, scalars stay
253
253
  assert _auto_columns(rows) == ["id", "name"]
254
254
 
255
255
 
@@ -266,8 +266,8 @@ def test_object_table_uses_auto_columns():
266
266
  {"emailaddress": "b@x", "quota": 2, "domain": "x"},
267
267
  ]
268
268
  table = _object_table(items)
269
- # constant `domain` dropped; the differing fields are kept as headers
270
- assert [c.header for c in table.columns] == ["emailaddress", "quota"]
269
+ # all scalar sub-fields are kept (empties/object-lists would be dropped)
270
+ assert [c.header for c in table.columns] == ["emailaddress", "quota", "domain"]
271
271
 
272
272
 
273
273
  def test_render_kv_drops_empty_and_nests_objects(capsys):
File without changes
File without changes
File without changes