List, filter, and export information about archive entries
(filter_patterns_str: Optional[str]=None,
filter_patterns: Optional[List[str]]=None,
filter_type: str='exact',
status: Optional[str]=None,
after: Optional[float]=None,
before: Optional[float]=None,
sort: Optional[str]=None,
csv: Optional[str]=None,
json: bool=False,
html: bool=False,
with_headers: bool=False,
out_dir: Path=OUTPUT_DIR)
| 844 | |
| 845 | @enforce_types |
| 846 | def list_all(filter_patterns_str: Optional[str]=None, |
| 847 | filter_patterns: Optional[List[str]]=None, |
| 848 | filter_type: str='exact', |
| 849 | status: Optional[str]=None, |
| 850 | after: Optional[float]=None, |
| 851 | before: Optional[float]=None, |
| 852 | sort: Optional[str]=None, |
| 853 | csv: Optional[str]=None, |
| 854 | json: bool=False, |
| 855 | html: bool=False, |
| 856 | with_headers: bool=False, |
| 857 | out_dir: Path=OUTPUT_DIR) -> Iterable[Link]: |
| 858 | """List, filter, and export information about archive entries""" |
| 859 | |
| 860 | check_data_folder(out_dir=out_dir) |
| 861 | |
| 862 | if filter_patterns and filter_patterns_str: |
| 863 | stderr( |
| 864 | '[X] You should either pass filter patterns as an arguments ' |
| 865 | 'or via stdin, but not both.\n', |
| 866 | color='red', |
| 867 | ) |
| 868 | raise SystemExit(2) |
| 869 | elif filter_patterns_str: |
| 870 | filter_patterns = filter_patterns_str.split('\n') |
| 871 | |
| 872 | snapshots = list_links( |
| 873 | filter_patterns=filter_patterns, |
| 874 | filter_type=filter_type, |
| 875 | before=before, |
| 876 | after=after, |
| 877 | ) |
| 878 | |
| 879 | if sort: |
| 880 | snapshots = snapshots.order_by(sort) |
| 881 | |
| 882 | folders = list_folders( |
| 883 | links=snapshots, |
| 884 | status=status, |
| 885 | out_dir=out_dir, |
| 886 | ) |
| 887 | |
| 888 | if json: |
| 889 | output = generate_json_index_from_links(folders.values(), with_headers) |
| 890 | elif html: |
| 891 | output = generate_index_from_links(folders.values(), with_headers) |
| 892 | elif csv: |
| 893 | output = links_to_csv(folders.values(), cols=csv.split(','), header=with_headers) |
| 894 | else: |
| 895 | output = printable_folders(folders, with_headers=with_headers) |
| 896 | print(output) |
| 897 | return folders |
| 898 | |
| 899 | |
| 900 | @enforce_types |
no test coverage detected