add -p cmd-opt

This commit is contained in:
Christopher Roy Bratusek 2012-11-25 11:58:04 +01:00
parent bb7ca22946
commit 7f38e480be
2 changed files with 25 additions and 6 deletions

View File

@ -4,11 +4,12 @@
* only install qm-files for translation, not ts-files aswell * only install qm-files for translation, not ts-files aswell
* changed default directory to $HOME (so that file-selectors * changed default directory to $HOME (so that file-selectors
don't start at Qwads source or installation directory) don't start at Qwads source or installation directory)
* add command line options: * add command line options (NOTE: all paths must be absolute!):
-h / --help = show help -h / --help = show help
-v / --version = show Qwad version and exit -v / --version = show Qwad version and exit
-d / --download = download IOS (see examples below) -d / --download = download IOS (see examples below)
-u / --unpack = unpack a wad file -u / --unpack = unpack a wad file
-p / --pack = pack a folder as wad
-g / --getversions = get available versions of given IOS -g / --getversions = get available versions of given IOS
-c / --convert = convert IOS name to hex (and vice versa) -c / --convert = convert IOS name to hex (and vice versa)
====================================================================== ======================================================================
@ -22,9 +23,14 @@
**Unpack** **Unpack**
qwad -u <WAD> <FOLDER> qwad -u <WAD> <FOLDER>
qwad -u IOS58.wad IOS58-Unpacked qwad -u $PWD/IOS58.wad $PWD/IOS58-Unpacked
>> Result: IOS58-Unpacked/ >> Result: IOS58-Unpacked/
**Pack**
qwad -p <FOLDER> <WAD>
qwad -p $PWD/IOS58-Unpacked/ $PWD/IOS58.wad
>> Result: IOS58.wad
**GetVersions** **GetVersions**
qwad -g <IOS> qwad -g <IOS>
qwad -g IOS9 qwad -g IOS9

View File

@ -35,7 +35,8 @@ def opts():
help="IOS Version Output Decrypt Pack") help="IOS Version Output Decrypt Pack")
parser.add_option('-u', "--unpack", dest="unpack", action="extend", parser.add_option('-u', "--unpack", dest="unpack", action="extend",
type="string", metavar='Arguments', help="unpack a WAD") type="string", metavar='Arguments', help="unpack a WAD")
parser.add_option('-p', "--pack", dest="pack", action="extend",
type="string", metavar='Arguments', help="pack folder as WAD")
parser.add_option('-g', "--getversions", dest="getversions", parser.add_option('-g', "--getversions", dest="getversions",
action="store_true", default=False, help="get available versions for IOS") action="store_true", default=False, help="get available versions for IOS")
parser.add_option('-c', "--convert", dest="convert", parser.add_option('-c', "--convert", dest="convert",
@ -88,13 +89,25 @@ def opts():
else: else:
os.mkdir(str(args[0]), 0755) os.mkdir(str(args[0]), 0755)
if os.access(str(args[0]), os.W_OK): if os.access(str(args[0]), os.W_OK):
folder = str(args[0]) UnpackingCLI(wad, str(args[0])).start()
UnpackingCLI(wad, folder).start()
sys.exit(0) sys.exit(0)
else: else:
print "Output folder %s not writeable." % str(args[0]) print "Output folder %s not writeable." % str(args[0])
sys.exit(1) sys.exit(1)
if options.pack:
if os.access(str(options.pack[0]), os.R_OK):
folder = str(options.pack[0])
else:
print "Input folder %s not readable." % str(options.pack[0])
sys.exit(1)
if os.access(os.path.dirname(str(args[0])), os.W_OK):
PackingCLI(folder, str(args[0])).start()
sys.exit(0)
else:
print "Output file %s can't be created." % str(args[0])
sys.exit(1)
def main(): def main():
# load our own translations # load our own translations
translator = QTranslator() translator = QTranslator()