-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE] Enable fine-grain control over CLI output, for improved usability in scripting. #93
Comments
I love this feature suggestion 😁 because you are thinking about how to make the output of the tool more easily read by other software. I have one suggestion about how to make the output super machine readable. Output a valid JSON string containing the values you'd normally print when the Default tool behavior on an archiveFrom[PartitionFs]
Type: Nested HFS0
DirNum: 3
FileNum: 8 To{
"partitionFileSystem": {
"type": "Nested HFS0",
"totals": {
"directories": "3",
"files": "8"
}
}
} Listing file systemFrom[GameCard/Header]
CardHeaderVersion: 0
RomSize: 1GB
PackageId: 0x66a9c5a9c0f45087
Flags: 0x00
SelSec: 0x1
SelT1Key: 0x2
SelKey: 0x0
[PartitionFs]
Type: Nested HFS0
DirNum: 3
FileNum: 8
[PartitionFs/Tree]
gamecard:/
update/
normal/
secure/
d410961e1dc9a4fde688ff19f80a4a3f.nca
1d57e359fdd5773e4a7030d4700ceece.nca
e1db2c894276b8918377f0b4a26d8070.nca
b34f8b09c419320be1f2966c2c3a609a.cnmt.nca
04b55d1660cf95359b636ba1170a668f.nca
db9912b1a244cd0eed73755c3cf42ca7.nca
4ce4826de607d37626642db89151ac30.nca
8ad12697d849c2cd3a7b12cf45682b8e.cnmt.nca ToYou will notice that each file on the system is its own object in the array instead of a single string element in the array. This makes extending the amount of information easier in the future. For example: if you eventually add the file size or header information for each file. {
"header": {
"CardHeaderVersion": 0,
"RomSize": "1GB",
"PackageId": "0x66a9c5a9c0f45087",
"Flags": "0x00",
"SelSec": "0x1",
"SelT1Key": "0x2",
"SelKey": "0x0"
},
"partitionFileSystem": {
"type": "Nested HFS0",
"totals": {
"directories": "3",
"files": "8"
},
"tree": {
"update": [],
"normal": [],
"secure": [
{
"filename": "d410961e1dc9a4fde688ff19f80a4a3f.nca",
"extractpath": "secure/d410961e1dc9a4fde688ff19f80a4a3f.nca"
},
{
"filename": "1d57e359fdd5773e4a7030d4700ceece.nca",
"extractpath": "secure/1d57e359fdd5773e4a7030d4700ceece.nca"
},
{
"filename": "e1db2c894276b8918377f0b4a26d8070.nca",
"extractpath": "secure/e1db2c894276b8918377f0b4a26d8070.nca"
},
{
"filename": "b34f8b09c419320be1f2966c2c3a609a.cnmt.nca",
"extractpath": "secure/b34f8b09c419320be1f2966c2c3a609a.cnmt.nca"
},
{
"filename": "04b55d1660cf95359b636ba1170a668f.nca",
"extractpath": "secure/04b55d1660cf95359b636ba1170a668f.nca"
},
{
"filename": "db9912b1a244cd0eed73755c3cf42ca7.nca",
"extractpath": "secure/db9912b1a244cd0eed73755c3cf42ca7.nca"
},
{
"filename": "4ce4826de607d37626642db89151ac30.nca",
"extractpath": "secure/4ce4826de607d37626642db89151ac30.nca"
},
{
"filename": "8ad12697d849c2cd3a7b12cf45682b8e.nca",
"extractpath": "secure/8ad12697d849c2cd3a7b12cf45682b8e.nca"
}
]
}
}
} Default tool behavior on a NCA fileFrom[NCA Header]
Format Type: NCA3
Dist. Type: Download
Content Type: Meta
Key Generation: 11
Sig. Generation: 0
Kaek Index: Application (0)
Size: 0xe00
ProgID: 0x01006b8014020000
Content Index: 0
SdkAddon Ver.: 12.0.0 (v201326592) To{
"header": {
"format": "NCA3",
"distribution": "Download",
"content": "Meta",
"keyGeneration": 11,
"signatureGeneration": 0,
"kaekIndex": "Application (0)",
"size": "0xe00",
"programID": "0x01006b8014020000",
"contentIndex": 0,
"SDKAddonVersion": "12.0.0 (v201326592)"
}
} |
About
To improve usability in scripting use-cases, three modes shall be provided to control what output is written to stdout/stderr.
Design
Modes
Silent Mode
- Omit presenting file information to output-q
/--quiet
Verbose Mode
- Where information has been summarised, present the full version instead-v
/--verbose
Verify Mode
- Verify the file structures where possible, and present errors to output-y
/--verify
Output Types
NSTool shall classify CLI output as one of three types:
stdout
.silent mode
.verbose mode
.stderr
.verbose mode
.[nstool::ClassNameHere LOG] ...
.Extracting X to Y...
.stderr
.[nstool::ClassNameHere ERROR] ...
.verify mode
.verbose mode
.Requirements
The text was updated successfully, but these errors were encountered: