contree-cli 0.7.0__tar.gz → 0.7.1__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.
- {contree_cli-0.7.0 → contree_cli-0.7.1}/PKG-INFO +1 -1
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/cli/file.py +22 -24
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/cli/images.py +13 -15
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/cli/operation.py +16 -18
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/client.py +11 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/pyproject.toml +1 -1
- {contree_cli-0.7.0 → contree_cli-0.7.1}/LICENSE +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/README.md +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/__init__.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/__main__.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/agent.md +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/arguments.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/cli/__init__.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/cli/agent.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/cli/auth.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/cli/build.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/cli/cat.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/cli/cd.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/cli/cp.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/cli/env.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/cli/ls.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/cli/run.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/cli/session.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/cli/show.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/cli/skill.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/cli/tag.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/cli/use.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/config.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/docker/__init__.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/docker/context.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/docker/dockerignore.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/docker/keyword.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/docker/kw_add.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/docker/kw_arg.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/docker/kw_copy.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/docker/kw_env.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/docker/kw_from.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/docker/kw_run.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/docker/kw_skipped.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/docker/kw_user.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/docker/kw_workdir.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/docker/local_context.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/docker/parser.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/docker/url_fetch.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/log.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/man.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/manual.md +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/mapped_file.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/migrations.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/output.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/py.typed +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/refs.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/session.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/shell/__init__.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/shell/argmap.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/shell/argspec.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/shell/cache.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/shell/completer.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/shell/history.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/shell/parser.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/shell/repl.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/shell/sources.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/shell/trie.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/skill.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/skill_body.md +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/types.py +0 -0
- {contree_cli-0.7.0 → contree_cli-0.7.1}/contree_cli/update_check.py +0 -0
|
@@ -328,37 +328,35 @@ def cmd_file_ls(args: FileListArgs) -> int | None:
|
|
|
328
328
|
if args.until is not None:
|
|
329
329
|
params["until"] = isoformat_datetime(args.until)
|
|
330
330
|
|
|
331
|
-
|
|
331
|
+
emitted = 0
|
|
332
|
+
hit_limit = False
|
|
333
|
+
with PaginatedFetcher(
|
|
332
334
|
client,
|
|
333
335
|
"/v1/files",
|
|
334
336
|
params,
|
|
335
337
|
lambda body: json.loads(body).get("files", []),
|
|
336
338
|
limit=args.limit,
|
|
337
339
|
concurrency=CONTREE_CONCURRENCY,
|
|
338
|
-
)
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
340
|
+
) as fetcher:
|
|
341
|
+
for page in fetcher:
|
|
342
|
+
for entry in page:
|
|
343
|
+
if emitted >= args.limit:
|
|
344
|
+
hit_limit = True
|
|
345
|
+
break
|
|
346
|
+
uuid_str = entry.get("uuid")
|
|
347
|
+
source = sources.get(uuid_str, "") if isinstance(uuid_str, str) else ""
|
|
348
|
+
if args.quiet:
|
|
349
|
+
formatter(
|
|
350
|
+
uuid=uuid_str,
|
|
351
|
+
sha256=entry.get("sha256", ""),
|
|
352
|
+
source=source,
|
|
353
|
+
)
|
|
354
|
+
else:
|
|
355
|
+
formatter(**{**entry, "source": source})
|
|
356
|
+
emitted += 1
|
|
357
|
+
formatter.flush()
|
|
358
|
+
if hit_limit:
|
|
346
359
|
break
|
|
347
|
-
uuid_str = entry.get("uuid")
|
|
348
|
-
source = sources.get(uuid_str, "") if isinstance(uuid_str, str) else ""
|
|
349
|
-
if args.quiet:
|
|
350
|
-
formatter(
|
|
351
|
-
uuid=uuid_str,
|
|
352
|
-
sha256=entry.get("sha256", ""),
|
|
353
|
-
source=source,
|
|
354
|
-
)
|
|
355
|
-
else:
|
|
356
|
-
formatter(**{**entry, "source": source})
|
|
357
|
-
emitted += 1
|
|
358
|
-
formatter.flush()
|
|
359
|
-
if hit_limit:
|
|
360
|
-
fetcher.stop()
|
|
361
|
-
break
|
|
362
360
|
|
|
363
361
|
if hit_limit:
|
|
364
362
|
logger.warning(
|
|
@@ -272,28 +272,26 @@ def cmd_images(args: ImagesArgs) -> None:
|
|
|
272
272
|
if args.until is not None:
|
|
273
273
|
base_params["until"] = isoformat_datetime(args.until)
|
|
274
274
|
|
|
275
|
-
|
|
275
|
+
emitted = 0
|
|
276
|
+
hit_limit = False
|
|
277
|
+
with PaginatedFetcher(
|
|
276
278
|
client,
|
|
277
279
|
"/v1/images",
|
|
278
280
|
base_params,
|
|
279
281
|
lambda body: json.loads(body)["images"],
|
|
280
282
|
limit=args.limit,
|
|
281
283
|
concurrency=CONTREE_CONCURRENCY,
|
|
282
|
-
)
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
284
|
+
) as fetcher:
|
|
285
|
+
for page in fetcher:
|
|
286
|
+
for image in page:
|
|
287
|
+
if emitted >= args.limit:
|
|
288
|
+
hit_limit = True
|
|
289
|
+
break
|
|
290
|
+
formatter(**image)
|
|
291
|
+
emitted += 1
|
|
292
|
+
formatter.flush()
|
|
293
|
+
if hit_limit:
|
|
290
294
|
break
|
|
291
|
-
formatter(**image)
|
|
292
|
-
emitted += 1
|
|
293
|
-
formatter.flush()
|
|
294
|
-
if hit_limit:
|
|
295
|
-
fetcher.stop()
|
|
296
|
-
break
|
|
297
295
|
|
|
298
296
|
if hit_limit:
|
|
299
297
|
logger.warning(
|
|
@@ -393,31 +393,29 @@ def cmd_list(args: ListArgs) -> None:
|
|
|
393
393
|
base_params["until"] = isoformat_datetime(args.until)
|
|
394
394
|
|
|
395
395
|
limit = args.show_max
|
|
396
|
-
|
|
396
|
+
emitted = 0
|
|
397
|
+
hit_limit = False
|
|
398
|
+
with PaginatedFetcher(
|
|
397
399
|
client,
|
|
398
400
|
"/v1/operations",
|
|
399
401
|
base_params,
|
|
400
402
|
json.loads,
|
|
401
403
|
limit=limit,
|
|
402
404
|
concurrency=CONTREE_CONCURRENCY,
|
|
403
|
-
)
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
405
|
+
) as fetcher:
|
|
406
|
+
for page in fetcher:
|
|
407
|
+
for op in page:
|
|
408
|
+
if limit is not None and emitted >= limit:
|
|
409
|
+
hit_limit = True
|
|
410
|
+
break
|
|
411
|
+
if args.quiet:
|
|
412
|
+
print(op["uuid"])
|
|
413
|
+
else:
|
|
414
|
+
formatter(**op)
|
|
415
|
+
emitted += 1
|
|
416
|
+
formatter.flush()
|
|
417
|
+
if hit_limit:
|
|
411
418
|
break
|
|
412
|
-
if args.quiet:
|
|
413
|
-
print(op["uuid"])
|
|
414
|
-
else:
|
|
415
|
-
formatter(**op)
|
|
416
|
-
emitted += 1
|
|
417
|
-
formatter.flush()
|
|
418
|
-
if hit_limit:
|
|
419
|
-
fetcher.stop()
|
|
420
|
-
break
|
|
421
419
|
|
|
422
420
|
if hit_limit:
|
|
423
421
|
logger.warning(
|
|
@@ -619,6 +619,17 @@ class PaginatedFetcher:
|
|
|
619
619
|
"""Signal that the caller has seen enough; skip pending fetches."""
|
|
620
620
|
self._stop.set()
|
|
621
621
|
|
|
622
|
+
def __enter__(self) -> PaginatedFetcher:
|
|
623
|
+
return self
|
|
624
|
+
|
|
625
|
+
def __exit__(self, *_: object) -> None:
|
|
626
|
+
# Setting the stop event short-circuits any worker that hasn't
|
|
627
|
+
# started yet and prevents the iterator's refill from enqueueing
|
|
628
|
+
# more fetches. Callers wrap iteration in `with PaginatedFetcher(...)`
|
|
629
|
+
# so they don't have to remember an explicit `stop()` after
|
|
630
|
+
# breaking out of a paged loop.
|
|
631
|
+
self.stop()
|
|
632
|
+
|
|
622
633
|
def _fetch(self, offset: int) -> list[dict[str, Any]]:
|
|
623
634
|
if self._stop.is_set():
|
|
624
635
|
return []
|
|
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
|
|
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
|
|
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
|