-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcli.py
35 lines (30 loc) · 870 Bytes
/
cli.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from pprint import pprint
import pathlib as plb
import logging as log
import argparse
from sequencers import files_sequences
FORMAT = "%(asctime)s %(levelname)s %(message)s"
log.basicConfig(
format=FORMAT,
level=log.INFO,
filemode="w",
)
parser = argparse.ArgumentParser(
description="Reformate view of seqences files."
)
parser.add_argument(
"-p", "--path", type=str, default="", help="Path at explorer."
)
args = parser.parse_args()
path = plb.Path(args.path)
if str(path) == ".":
path = path.cwd()
log.info(f"Path is not set. Choise automatic {path}.")
elif not path.is_dir():
log.fatal("Path is not directoy.")
raise ValueError("Path is not directoy.")
elif not path.exists():
log.fatal("Path not exists.")
raise
files = (str(path_f.name) for path_f in path.iterdir())
pprint(files_sequences.format_sequences(files))