mirror of
https://github.com/ArchiveBox/ArchiveBox
synced 2024-11-10 06:34:16 +00:00
feat: Update list
command to sort using sqlite
This commit is contained in:
parent
f55153eab3
commit
7e9d195d13
2 changed files with 17 additions and 3 deletions
|
@ -733,8 +733,8 @@ def list_all(filter_patterns_str: Optional[str]=None,
|
|||
after=after,
|
||||
)
|
||||
|
||||
#if sort:
|
||||
# snapshots = sorted(links, key=lambda link: getattr(link, sort))
|
||||
if sort:
|
||||
snapshots = snapshots.order_by(sort)
|
||||
|
||||
folders = list_folders(
|
||||
links=snapshots,
|
||||
|
|
|
@ -35,4 +35,18 @@ def test_list_html_index(process, disable_extractors_dict):
|
|||
|
||||
def test_list_index_with_wrong_flags(process):
|
||||
list_process = subprocess.run(["archivebox", "list", "--index"], capture_output=True)
|
||||
assert "--index can only be used with --json or --html options." in list_process.stderr.decode("utf-8")
|
||||
assert "--index can only be used with --json or --html options." in list_process.stderr.decode("utf-8")
|
||||
|
||||
def test_link_sort_by_url(process, disable_extractors_dict):
|
||||
subprocess.run(["archivebox", "add", "http://127.0.0.1:8080/static/iana.org.html", "--depth=0"],
|
||||
capture_output=True, env=disable_extractors_dict)
|
||||
subprocess.run(["archivebox", "add", "http://127.0.0.1:8080/static/example.com.html", "--depth=0"],
|
||||
capture_output=True, env=disable_extractors_dict)
|
||||
|
||||
list_process = subprocess.run(["archivebox", "list"], capture_output=True)
|
||||
link_list = list_process.stdout.decode("utf-8").split("\n")
|
||||
assert "http://127.0.0.1:8080/static/iana.org.html" in link_list[0]
|
||||
|
||||
list_process = subprocess.run(["archivebox", "list", "--sort=url"], capture_output=True)
|
||||
link_list = list_process.stdout.decode("utf-8").split("\n")
|
||||
assert "http://127.0.0.1:8080/static/example.com.html" in link_list[0]
|
Loading…
Reference in a new issue