mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-12 22:25:44 -04:00
Delete click_test.py
This commit is contained in:
parent
ad7eec26b2
commit
5ce25d7518
1 changed files with 0 additions and 30 deletions
|
@ -1,30 +0,0 @@
|
||||||
import sys
|
|
||||||
import click
|
|
||||||
from rich import print
|
|
||||||
from archivebox.config.django import setup_django
|
|
||||||
|
|
||||||
setup_django()
|
|
||||||
|
|
||||||
|
|
||||||
def parse_stdin_to_args(io=sys.stdin):
|
|
||||||
for line in io.read().split('\n'):
|
|
||||||
for url_or_id in line.split(' '):
|
|
||||||
if url_or_id.strip():
|
|
||||||
yield url_or_id.strip()
|
|
||||||
|
|
||||||
|
|
||||||
# Gather data from stdin in case using a pipe
|
|
||||||
if not sys.stdin.isatty():
|
|
||||||
sys.argv += parse_stdin_to_args(sys.stdin)
|
|
||||||
|
|
||||||
|
|
||||||
@click.command()
|
|
||||||
@click.argument("snapshot_ids_or_urls", type=str, nargs=-1)
|
|
||||||
def extract(snapshot_ids_or_urls):
|
|
||||||
for url_or_snapshot_id in snapshot_ids_or_urls:
|
|
||||||
print('- EXTRACTING', url_or_snapshot_id, file=sys.stderr)
|
|
||||||
for result in archivebox.pm.hook.extract(url_or_snapshot_id):
|
|
||||||
print(result)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
extract()
|
|
Loading…
Add table
Add a link
Reference in a new issue