mirror of
https://github.com/dgelessus/python-rsrcfork.git
synced 2025-07-26 11:25:01 +00:00
Fix missing sys.exit calls in CLI subcommand functions
This commit is contained in:
@@ -498,6 +498,8 @@ on Mac OS X normally have both parts of the header data set to all zero bytes.
|
|||||||
else:
|
else:
|
||||||
raise AssertionError(f"Unhandled --format: {ns.format!r}")
|
raise AssertionError(f"Unhandled --format: {ns.format!r}")
|
||||||
|
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
def do_info(prog: str, args: typing.List[str]) -> typing.NoReturn:
|
def do_info(prog: str, args: typing.List[str]) -> typing.NoReturn:
|
||||||
"""Display technical information about the resource file."""
|
"""Display technical information about the resource file."""
|
||||||
|
|
||||||
@@ -530,6 +532,8 @@ Display technical information and stats about the resource file.
|
|||||||
print(f"Resource map type list starts at {rf.map_type_list_offset:#x} (relative to map start) and contains {len(rf)} types")
|
print(f"Resource map type list starts at {rf.map_type_list_offset:#x} (relative to map start) and contains {len(rf)} types")
|
||||||
print(f"Resource map name list starts at {rf.map_name_list_offset:#x} (relative to map start)")
|
print(f"Resource map name list starts at {rf.map_name_list_offset:#x} (relative to map start)")
|
||||||
|
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
def do_list(prog: str, args: typing.List[str]) -> typing.NoReturn:
|
def do_list(prog: str, args: typing.List[str]) -> typing.NoReturn:
|
||||||
"""List the resources in a file."""
|
"""List the resources in a file."""
|
||||||
|
|
||||||
@@ -562,6 +566,8 @@ decompress the resource data.
|
|||||||
resources = list(filter_resources(rf, ns.filter))
|
resources = list(filter_resources(rf, ns.filter))
|
||||||
list_resources(resources, sort=ns.sort, group=ns.group, decompress=ns.decompress)
|
list_resources(resources, sort=ns.sort, group=ns.group, decompress=ns.decompress)
|
||||||
|
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
def do_resource_info(prog: str, args: typing.List[str]) -> typing.NoReturn:
|
def do_resource_info(prog: str, args: typing.List[str]) -> typing.NoReturn:
|
||||||
"""Display technical information about resources."""
|
"""Display technical information about resources."""
|
||||||
|
|
||||||
@@ -589,7 +595,7 @@ Display technical information about one or more resources.
|
|||||||
|
|
||||||
if not resources:
|
if not resources:
|
||||||
print("No resources matched the filter")
|
print("No resources matched the filter")
|
||||||
return
|
sys.exit(0)
|
||||||
|
|
||||||
for res in resources:
|
for res in resources:
|
||||||
restype = bytes_escape(res.type, quote="'")
|
restype = bytes_escape(res.type, quote="'")
|
||||||
@@ -625,6 +631,8 @@ Display technical information about one or more resources.
|
|||||||
|
|
||||||
print()
|
print()
|
||||||
|
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
def do_read(prog: str, args: typing.List[str]) -> typing.NoReturn:
|
def do_read(prog: str, args: typing.List[str]) -> typing.NoReturn:
|
||||||
"""Read data from resources."""
|
"""Read data from resources."""
|
||||||
|
|
||||||
@@ -653,6 +661,8 @@ Read the data of one or more resources.
|
|||||||
|
|
||||||
show_filtered_resources(resources, format=ns.format, decompress=ns.decompress)
|
show_filtered_resources(resources, format=ns.format, decompress=ns.decompress)
|
||||||
|
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
def do_raw_compress_info(prog: str, args: typing.List[str]) -> typing.NoReturn:
|
def do_raw_compress_info(prog: str, args: typing.List[str]) -> typing.NoReturn:
|
||||||
"""Display technical information about raw compressed resource data."""
|
"""Display technical information about raw compressed resource data."""
|
||||||
|
|
||||||
@@ -682,6 +692,8 @@ in a standalone file and not as a resource in a resource file.
|
|||||||
if close_in_stream:
|
if close_in_stream:
|
||||||
in_stream.close()
|
in_stream.close()
|
||||||
|
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
def do_raw_decompress(prog: str, args: typing.List[str]) -> typing.NoReturn:
|
def do_raw_decompress(prog: str, args: typing.List[str]) -> typing.NoReturn:
|
||||||
"""Decompress raw compressed resource data."""
|
"""Decompress raw compressed resource data."""
|
||||||
|
|
||||||
@@ -742,6 +754,8 @@ handle resource compression).
|
|||||||
if close_in_stream:
|
if close_in_stream:
|
||||||
in_stream.close()
|
in_stream.close()
|
||||||
|
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
SUBCOMMANDS = {
|
SUBCOMMANDS = {
|
||||||
"read-header": do_read_header,
|
"read-header": do_read_header,
|
||||||
|
Reference in New Issue
Block a user