fix(ls): rename --quick to --quiet; add version command; bump to 1.3.14
- Fix ls -q long option name: --quick → --quiet (typo fix) - Remove mdrsclient/VERSION file; read version via importlib.metadata - Bump version 1.3.13 → 1.3.14 - Add Python 3.14 to supported classifiers; promote to Development Status 4 - Beta - Add `version` subcommand (prints "mdrs <version>") - Document `version` command in README Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -23,7 +23,7 @@ class LsCommandContext:
|
||||
laboratory: Laboratory
|
||||
password: str
|
||||
is_json: bool
|
||||
is_quick: bool
|
||||
is_quiet: bool
|
||||
is_recursive: bool
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ class LsCommand(BaseCommand):
|
||||
ls_parser.add_argument("-J", "--json", help="turn on json output", action="store_true")
|
||||
ls_parser.add_argument(
|
||||
"-q",
|
||||
"--quick",
|
||||
"--quiet",
|
||||
help="don't output header row. this option is forced if the -r option is specified",
|
||||
action="store_true",
|
||||
)
|
||||
@@ -49,11 +49,11 @@ class LsCommand(BaseCommand):
|
||||
password = str(args.password) if args.password else None
|
||||
is_json = bool(args.json)
|
||||
is_recursive = bool(args.recursive)
|
||||
is_quick = bool(args.quick) if not is_recursive else True
|
||||
cls.ls(remote_path, password, is_json, is_recursive, is_quick)
|
||||
is_quiet = bool(args.quiet) if not is_recursive else True
|
||||
cls.ls(remote_path, password, is_json, is_recursive, is_quiet)
|
||||
|
||||
@classmethod
|
||||
def ls(cls, remote_path: str, password: str | None, is_json: bool, is_recursive: bool, is_quick: bool) -> None:
|
||||
def ls(cls, remote_path: str, password: str | None, is_json: bool, is_recursive: bool, is_quiet: bool) -> None:
|
||||
(remote, laboratory_name, r_path) = cls._parse_remote_host_with_path(remote_path)
|
||||
connection = cls._create_connection(remote)
|
||||
laboratory = cls._find_laboratory(connection, laboratory_name)
|
||||
@@ -63,7 +63,7 @@ class LsCommand(BaseCommand):
|
||||
laboratory,
|
||||
password if password is not None else "",
|
||||
is_json,
|
||||
is_quick,
|
||||
is_quiet,
|
||||
is_recursive,
|
||||
)
|
||||
folder = cls._find_folder(connection, laboratory, r_path, password)
|
||||
@@ -89,7 +89,7 @@ class LsCommand(BaseCommand):
|
||||
}
|
||||
length: dict[str, int] = {}
|
||||
for key in label.keys():
|
||||
length[key] = len(label[key]) if not context.is_quick else 0
|
||||
length[key] = len(label[key]) if not context.is_quiet else 0
|
||||
for sub_folder in folder.sub_folders:
|
||||
sub_laboratory = context.connection.laboratories.find_by_id(sub_folder.laboratory_id)
|
||||
sub_laboratory_name = sub_laboratory.name if sub_laboratory is not None else "(invalid)"
|
||||
@@ -114,7 +114,7 @@ class LsCommand(BaseCommand):
|
||||
print(f"{context.prefix}{folder.path}:")
|
||||
print(f"total {sum(f.size for f in files)}")
|
||||
|
||||
if not context.is_quick:
|
||||
if not context.is_quiet:
|
||||
print(header)
|
||||
print("-" * len(header.expandtabs()))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user