-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ebd5834
commit f57fab0
Showing
3 changed files
with
41 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
from argparse import ArgumentParser | ||
from pathlib import Path | ||
import asyncio | ||
import re | ||
import sys | ||
|
||
from ..lib import create_default_drive | ||
|
||
|
||
async def main(args: list[str]) -> int: | ||
parser = ArgumentParser("lseh") | ||
parser.add_argument("path", type=str) | ||
kwargs = parser.parse_args(args) | ||
path = Path(kwargs.path) | ||
|
||
async with create_default_drive() as drive: | ||
parent = await drive.get_node_by_path(path) | ||
children = await drive.get_children(parent) | ||
g = ((to_eid(_.name), _.name) for _ in children) | ||
pair_list = [(eid, name) for eid, name in g if eid is not None] | ||
pair_list.sort(reverse=True) | ||
name_list = (name for _eid, name in pair_list) | ||
for name in name_list: | ||
print(name) | ||
|
||
return 0 | ||
|
||
|
||
def to_eid(name: str) -> int | None: | ||
m = re.search(r"\[(\d+)\]\.7z$", name) | ||
if not m: | ||
return None | ||
eid = int(m.group(1)) | ||
return eid | ||
|
||
|
||
if __name__ == "__main__": | ||
sys.exit(asyncio.run(main(sys.argv[1:]))) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#! /bin/sh | ||
|
||
poetry run -- python3 -m app.unstable.listeh "$@" |