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
* changed default directory to $HOME (so that file-selectors
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
-v / --version = show Qwad version and exit
-d / --download = download IOS (see examples below)
-u / --unpack = unpack a wad file
-p / --pack = pack a folder as wad
-g / --getversions = get available versions of given IOS
-c / --convert = convert IOS name to hex (and vice versa)
======================================================================
@ -21,10 +22,15 @@
>> Result: IOS58.wad
**Unpack**
qwad -u <WAD> <FOLDER>
qwad -u IOS58.wad IOS58-Unpacked
qwad -u <WAD> <FOLDER>
qwad -u $PWD/IOS58.wad $PWD/IOS58-Unpacked
>> Result: IOS58-Unpacked/
**Pack**
qwad -p <FOLDER> <WAD>
qwad -p $PWD/IOS58-Unpacked/ $PWD/IOS58.wad
>> Result: IOS58.wad
**GetVersions**
qwad -g <IOS>
qwad -g IOS9

View File

@ -35,7 +35,8 @@ def opts():
help="IOS Version Output Decrypt Pack")
parser.add_option('-u', "--unpack", dest="unpack", action="extend",
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",
action="store_true", default=False, help="get available versions for IOS")
parser.add_option('-c', "--convert", dest="convert",
@ -88,13 +89,25 @@ def opts():
else:
os.mkdir(str(args[0]), 0755)
if os.access(str(args[0]), os.W_OK):
folder = str(args[0])
UnpackingCLI(wad, folder).start()
UnpackingCLI(wad, str(args[0])).start()
sys.exit(0)
else:
print "Output folder %s not writeable." % str(args[0])
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():
# load our own translations
translator = QTranslator()