Print All option for info

`-a`/`--all` for irdkit info command
This commit is contained in:
Deterous
2025-08-19 11:37:11 +09:00
committed by GitHub
parent 048d70b473
commit ce5b610f92
6 changed files with 143 additions and 20 deletions
+8 -5
View File
@@ -5,18 +5,21 @@
<OutputType>Exe</OutputType>
<TargetName>irdkit</TargetName>
<AssemblyName>irdkit</AssemblyName>
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<RuntimeIdentifiers>win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64;osx-arm64</RuntimeIdentifiers>
<CheckEolTargetFramework>false</CheckEolTargetFramework>
<LangVersion>latest</LangVersion>
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
<PublishSingleFile>true</PublishSingleFile>
<SelfContained>false</SelfContained>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Version>0.9.3</Version>
<Version>0.9.5</Version>
<!-- Package Properties -->
<Authors>Deterous</Authors>
<Description>Library for ISO Rebuild Data</Description>
<Copyright>Copyright (c) Deterous 2023-2024</Copyright>
<Copyright>Copyright (c) Deterous 2023-2025</Copyright>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/Deterous/LibIRD</RepositoryUrl>
<RepositoryType>git</RepositoryType>
@@ -30,8 +33,8 @@
<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="SabreTools.Hashing" Version="1.4.0" />
<PackageReference Include="SabreTools.RedumpLib" Version="1.5.2" />
<PackageReference Include="SabreTools.Hashing" Version="1.5.0" />
<PackageReference Include="SabreTools.RedumpLib" Version="1.7.0" />
</ItemGroup>
<ItemGroup>
+10 -5
View File
@@ -59,6 +59,9 @@ namespace IRDKit
[Option('o', "output", HelpText = "Path to the text or json file to be created (will overwrite)")]
public string OutPath { get; set; }
[Option('a', "all", HelpText = "Print the entire contents of the IRD")]
public bool All { get; set; }
[Option('j', "json", HelpText = "Print IRD or ISO information as a JSON object")]
public bool Json { get; set; }
@@ -283,7 +286,7 @@ namespace IRDKit
string lastIRD = irdFiles.Last();
foreach (string file in irdFiles)
{
PrintInfo(file, opt.Json, (noISO && file.Equals(lastIRD)), opt.OutPath);
PrintInfo(file, opt.Json, (noISO && file.Equals(lastIRD)), opt.OutPath, opt.All);
}
@@ -325,7 +328,7 @@ namespace IRDKit
}
// Print info from given file
PrintInfo(filePath, opt.Json, true, opt.OutPath);
PrintInfo(filePath, opt.Json, true, opt.OutPath, opt.All);
if (opt.OutPath != null && opt.OutPath != "")
Console.WriteLine($"Info saved to {opt.OutPath}");
@@ -464,8 +467,9 @@ namespace IRDKit
/// </summary>
/// <param name="inPath">File to retrieve info from</param>
/// <param name="json">Whether to format output as JSON (true) or plain text (false)</param>
/// <param name="single">Whether to print a single JSON object or not</param>
/// <param name="outPath">File to output info to</param>
public static void PrintInfo(string inPath, bool json, bool single = true, string outPath = null)
public static void PrintInfo(string inPath, bool json, bool single = true, string outPath = null, bool printAll = false)
{
// Check if file is an ISO
bool isISO = String.Compare(Path.GetExtension(inPath), ".iso", StringComparison.OrdinalIgnoreCase) == 0;
@@ -492,10 +496,10 @@ namespace IRDKit
File.AppendAllText(outPath, $"\"{Path.GetFileName(inPath)}\": ");
else
Console.Write($"\"{Path.GetFileName(inPath)}\": ");
ird.PrintJson(outPath, single);
ird.PrintJson(outPath, single, printAll);
}
else
IRD.Read(inPath).Print(outPath, Path.GetFileName(inPath));
IRD.Read(inPath).Print(outPath, Path.GetFileName(inPath), printAll);
if (json)
return;
@@ -518,6 +522,7 @@ namespace IRDKit
/// </summary>
/// <param name="isoPath">Path to ISO file</param>
/// <param name="json">Whether to format output as JSON (true) or plain text (false)</param>
/// <param name="single">Whether to print a single JSON object or not</param>
/// <param name="outPath">File to output info to</param>
/// <exception cref="FileNotFoundException"></exception>
/// <exception cref="InvalidFileSystemException"></exception>
+1
View File
@@ -32,6 +32,7 @@ For all options, run `irdkit help info`
To print info about an ISO or IRD file, run `irdkit info game.iso` or `irdkit info game.ird`
The info can be printed to a file, e.g. `-o out.txt` or `--output=`
The info can be formatted as a JSON with `-j` or `--json`
To print all info in the IRD use `-a` or `--all`
## Comparing IRDs