mirror of
https://github.com/dgelessus/python-rsrcfork.git
synced 2025-01-23 00:33:45 +00:00
Add a setuptools entry point for the command-line interface
This commit is contained in:
parent
9dfb33f436
commit
6247013592
@ -120,6 +120,7 @@ Changelog
|
||||
(next version)
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
* Added a setuptools entry point for the command-line interface. This allows calling it using just ``rsrcfork`` instead of ``python3 -m rsrcfork``.
|
||||
* Changed the default value of ``ResourceFork.__init__``'s ``close`` keyword argument from ``True`` to ``False``. This matches the behavior of classes like ``zipfile.ZipFile`` and ``tarfile.TarFile``.
|
||||
* Fixed ``ResourceFork.open`` and ``ResourceFork.__init__`` not closing their streams in some cases.
|
||||
* Refactored the single ``rsrcfork.py`` file into a package. This is an internal change and should have no effect on how the ``rsrcfork`` module is used.
|
||||
|
@ -160,7 +160,7 @@ def _raw_hexdump(data: bytes):
|
||||
for i in range(0, len(data), 16):
|
||||
print(" ".join(f"{byte:02x}" for byte in data[i:i + 16]))
|
||||
|
||||
def main(args: typing.Sequence[str]):
|
||||
def main():
|
||||
ap = argparse.ArgumentParser(
|
||||
add_help=False,
|
||||
fromfile_prefix_chars="@",
|
||||
@ -194,7 +194,7 @@ def main(args: typing.Sequence[str]):
|
||||
ap.add_argument("file", help="The file to read, or - for stdin")
|
||||
ap.add_argument("filter", nargs="*", help="One or more filters to select which resources to display, or omit to show an overview of all resources")
|
||||
|
||||
ns = ap.parse_args(args)
|
||||
ns = ap.parse_args()
|
||||
|
||||
ns.fork = {"auto": None, "data": False, "rsrc": True}[ns.fork]
|
||||
ns.read_mode = {"auto": None, "stream": False, "seek": True}[ns.read_mode]
|
||||
@ -348,4 +348,4 @@ def main(args: typing.Sequence[str]):
|
||||
sys.exit(0)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv[1:])
|
||||
sys.exit(main())
|
||||
|
Loading…
x
Reference in New Issue
Block a user