Display warnings when the old CLI syntax is used

This commit is contained in:
dgelessus 2019-10-22 10:46:25 +02:00
parent 3be4d9c969
commit 6fbb919285

View File

@ -433,17 +433,31 @@ def main_old(args: typing.List[str]) -> typing.NoReturn:
rf = api.ResourceFile.open(ns.file, fork=ns.fork) rf = api.ResourceFile.open(ns.file, fork=ns.fork)
with rf: with rf:
print("Warning: The syntax of the rsrcfork command has changed.", file=sys.stderr)
if ns.header_system or ns.header_application: if ns.header_system or ns.header_application:
if ns.header_system: if ns.header_system:
print('Please use "rsrcfork read-header --part=system <file>" instead of "rsrcfork --header-system <file>".', file=sys.stderr)
print(file=sys.stderr)
data = rf.header_system_data data = rf.header_system_data
else: else:
print('Please use "rsrcfork read-header --part=application <file>" instead of "rsrcfork --header-application <file>".', file=sys.stderr)
print(file=sys.stderr)
data = rf.header_application_data data = rf.header_application_data
show_header_data(data, format=ns.format) show_header_data(data, format=ns.format)
elif ns.filter or ns.all: elif ns.filter or ns.all:
if ns.filter: if ns.filter:
print('Please use "rsrcfork read <file> <filters...>" instead of "rsrcfork <file> <filters...>".', file=sys.stderr)
print(file=sys.stderr)
resources = filter_resources(rf, ns.filter) resources = filter_resources(rf, ns.filter)
else: else:
print('Please use "rsrcfork read <file>" instead of "rsrcfork <file> --all".', file=sys.stderr)
print(file=sys.stderr)
resources = [] resources = []
for reses in rf.values(): for reses in rf.values():
resources.extend(reses.values()) resources.extend(reses.values())
@ -453,6 +467,9 @@ def main_old(args: typing.List[str]) -> typing.NoReturn:
show_filtered_resources(resources, format=ns.format, decompress=ns.decompress) show_filtered_resources(resources, format=ns.format, decompress=ns.decompress)
else: else:
print('Please use "rsrcfork list <file>" instead of "rsrcfork <file>".', file=sys.stderr)
print(file=sys.stderr)
list_resource_file(rf, sort=ns.sort, group=ns.group, decompress=ns.decompress) list_resource_file(rf, sort=ns.sort, group=ns.group, decompress=ns.decompress)
sys.exit(0) sys.exit(0)