diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2020-05-15 13:17:11 +0300 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2020-05-15 13:17:11 +0300 |
commit | 316dc1fb80a4389e05e71cb88e79172d8b9caed3 (patch) | |
tree | 21e877592b2174a96ff6b5071f7d35aac1738ad4 | |
parent | Move scripts/rcc to top level (diff) | |
download | rcc-316dc1fb80a4389e05e71cb88e79172d8b9caed3.tar.xz |
rcc: add generate command
-rwxr-xr-x | rcc | 7 | ||||
-rw-r--r-- | rcc_format/__init__.py | 1 | ||||
-rwxr-xr-x | rcc_format/gen-resources.sh | 9 | ||||
-rwxr-xr-x | rcc_format/generate.py | 9 |
4 files changed, 15 insertions, 11 deletions
@@ -21,7 +21,6 @@ if __name__ == "__main__": description='Resource Compiler for C++', epilog='For a full list of compression options, check {mode} --help.', ) - mode = parser.add_subparsers(help='compression mode') none_mode = mode.add_parser('-') @@ -38,10 +37,14 @@ if __name__ == "__main__": zstd_mode.add_argument('-l', '--level', type=int, default=19, help='compression level') zstd_mode.set_defaults(func=rcc_format.zstd) + gen_mode = mode.add_parser('generate', description='Generate .xrc file from inputs') + gen_mode.add_argument('-a', '--alias', type=str, help='set alias') + gen_mode.set_defaults(func=rcc_format.generate) + parser.add_argument('input', type=argparse.FileType('rt'), help='input file (.xrc)') parser.add_argument('-o', '--output', type=argparse.FileType('wt'), default=sys.stdout, help='output header file') parser.add_argument('-n', '--namespace', type=str, default='resources', help='namespace') - + args=parser.parse_args() args.func(rcc_format.filelist(args.input), args) diff --git a/rcc_format/__init__.py b/rcc_format/__init__.py index 133bcc1..48ebd70 100644 --- a/rcc_format/__init__.py +++ b/rcc_format/__init__.py @@ -1,2 +1,3 @@ from rcc_format.util import * +from rcc_format.generate import generate from rcc_format.zstd import zstd diff --git a/rcc_format/gen-resources.sh b/rcc_format/gen-resources.sh deleted file mode 100755 index a1db9fd..0000000 --- a/rcc_format/gen-resources.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -echo '<RCC>' -echo ' <qresource prefix="/icons">' -for f in $@; do - echo ' <file alias="'$(basename $f)'">'$f'</file>'; -done -echo ' </qresource>' -echo '</RCC>' diff --git a/rcc_format/generate.py b/rcc_format/generate.py new file mode 100755 index 0000000..f42f6d4 --- /dev/null +++ b/rcc_format/generate.py @@ -0,0 +1,9 @@ +def generate(filelist, args): + print('<RCC>', file=args.output) + #echo ' <qresource prefix="/icons">' + #for f in $@; do + # echo ' <file alias="'$(basename $f)'">'$f'</file>'; + #done + #echo ' </qresource>' + print('</RCC>', file=args.output) + |