disable TOC by default (iconutil doesn't create it either)
This commit is contained in:
@@ -35,7 +35,7 @@ positional arguments:
|
||||
icnsutil e Existing.icns -o ./outdir/
|
||||
|
||||
# compose
|
||||
icnsutil c New.icns 16x16.png 16x16@2x.png *.jp2
|
||||
icnsutil c New.icns 16x16.png 16x16@2x.png *.jp2 --toc
|
||||
|
||||
# update
|
||||
icnsutil u Existing.icns -rm toc ic04 ic05
|
||||
@@ -78,7 +78,7 @@ img = icnsutil.IcnsFile('Existing.icns')
|
||||
img.add_media('icp4', file='16x16.png', force=True)
|
||||
if img.remove_media('TOC '):
|
||||
print('table of contents removed')
|
||||
img.write('Existing.icns', toc=False)
|
||||
img.write('Existing.icns', toc=True)
|
||||
|
||||
# print
|
||||
icnsutil.IcnsFile.description(fname, indent=2)
|
||||
|
||||
@@ -171,7 +171,7 @@ class IcnsFile:
|
||||
del self.media[key]
|
||||
return True
|
||||
|
||||
def write(self, fname: str, *, toc: bool = True) -> None:
|
||||
def write(self, fname: str, *, toc: bool = False) -> None:
|
||||
''' Create a new ICNS file from stored media. '''
|
||||
# Rebuild TOC to ensure soundness
|
||||
order = self._make_toc(enabled=toc)
|
||||
|
||||
@@ -41,7 +41,7 @@ def cli_compose(args: ArgParams) -> None:
|
||||
img = IcnsFile()
|
||||
for x in enum_with_stdin(args.source):
|
||||
img.add_media(file=x)
|
||||
img.write(dest, toc=not args.no_toc)
|
||||
img.write(dest, toc=args.toc)
|
||||
|
||||
|
||||
def cli_update(args: ArgParams) -> None:
|
||||
@@ -182,13 +182,13 @@ def main() -> None:
|
||||
cmd = add_command('compose', 'c', cli_compose)
|
||||
cmd.add_argument('-f', '--force', action='store_true',
|
||||
help='force overwrite output file')
|
||||
cmd.add_argument('--no-toc', action='store_true',
|
||||
help='do not write table of contents to file')
|
||||
cmd.add_argument('--toc', action='store_true',
|
||||
help='write table of contents to file')
|
||||
cmd.add_argument('target', type=str, metavar='destination',
|
||||
help='Output file for newly created icns file.')
|
||||
cmd.add_argument('source', type=PathExist('f', stdin=True), nargs='+',
|
||||
metavar='src',
|
||||
help='One or more media files: png, argb, plist, icns.')
|
||||
help='One or more media files: png, argb, rgb, jp2, icns')
|
||||
cmd.epilog = '''
|
||||
Notes:
|
||||
- TOC is optional but only a few bytes long (8b per media entry).
|
||||
|
||||
Reference in New Issue
Block a user