Argparse hack to show required arguments before optional

This commit is contained in:
Nichlas Severinsen 2019-11-02 22:16:34 +01:00
parent 44674ca62e
commit d229015710
2 changed files with 19 additions and 14 deletions

View file

@ -41,26 +41,27 @@ This will essentially automatically do the manual method for you.
## How do I use it?
First off, even before you install libray, you will need a compatible Blu-Ray drive that can read PS3 discs.
There's a compiled list of compatible drives here: [https://rpcs3.net/quickstart](https://rpcs3.net/quickstart) ([archive](https://web.archive.org/web/20190801060739/https://rpcs3.net/quickstart]))
```
usage: libray [-h] -i ISO [-o OUTPUT] [-k IRD] [-v]
A Libre (FLOSS) Python application for unencrypting, extracting, repackaging,
and encrypting PS3 ISOs
required arguments:
-i ISO, --iso ISO Path to .iso file or stream
optional arguments:
-h, --help show this help message and exit
-v, --verbose Increase verbosity
-o OUTPUT, --output OUTPUT
Output filename
-k IRD, --ird IRD Path to .ird file
-v, --verbose Increase verbosity
required arguments:
-i ISO, --iso ISO Path to .iso file
```
You need to use an appropriate blu-ray drive: https://rpcs3.net/quickstart (see "Compatible Blu-ray disc drives section").
First off, even before you install libray, you will need a compatible Blu-Ray drive that can read PS3 discs.
There's a compiled list of compatible drives here: [https://rpcs3.net/quickstart](https://rpcs3.net/quickstart) ([archive](https://web.archive.org/web/20190801060739/https://rpcs3.net/quickstart])) (see "Compatible Blu-ray disc drives section").
On some systems (eg. Linux), you can decrypt directly from the disc.
@ -116,11 +117,13 @@ sudo pip uninstall pycrypto
sudo pip install pycrypto
```
If you get any other errors, or have any other problem with libray, please [create an issue](https://notabug.org/necklace/libray/issues/new)!
## Development
[see also](http://www.psdevwiki.com/ps3/Bluray_disc#Encryption) ([archive.fo](https://archive.fo/hN1E6))
[7bit encoded int / RLE / CLP](https://github.com/Microsoft/referencesource/blob/master/mscorlib/system/io/binaryreader.cs#L582-L600)
[7bit encoded int / RLE / CLP](https://github.com/microsoft/referencesource/blob/1acafe20a789a55daa17aac6bb47d1b0ec04519f/mscorlib/system/io/binaryreader.cs#L582-L600)
clp = compressed length prefix

View file

@ -33,11 +33,13 @@ if __name__ == '__main__':
# Parse command line arguments with argpase
parser = argparse.ArgumentParser(description='A Libre (FLOSS) Python application for unencrypting, extracting, repackaging, and encrypting PS3 ISOs')
parser.add_argument('-v', '--verbose', help='Increase verbosity', action='count')
parser.add_argument('-o', '--output', dest='output', type=str, help='Output filename', default='')
parser.add_argument('-k', '--ird', dest='ird', type=str, help='Path to .ird file', default='')
parser._action_groups.pop()
required = parser.add_argument_group('required arguments')
required.add_argument('-i', '--iso', dest='iso', type=str, help='Path to .iso file', required=True)
optional = parser.add_argument_group('optional arguments')
required.add_argument('-i', '--iso', dest='iso', type=str, help='Path to .iso file or stream', required=True)
optional.add_argument('-o', '--output', dest='output', type=str, help='Output filename', default='')
optional.add_argument('-k', '--ird', dest='ird', type=str, help='Path to .ird file', default='')
optional.add_argument('-v', '--verbose', help='Increase verbosity', action='count')
args = parser.parse_args()
core.decrypt(args)