From 449fe5246c6c38142dacd9668fe292be61b96830 Mon Sep 17 00:00:00 2001 From: gmipf Date: Wed, 1 Jul 2026 20:24:46 +0200 Subject: [PATCH] Add man page output for the frontends Register the man page reference feature from SabreTools.CommandLine in MPF.CLI and MPF.Check so that "MPF.CLI man" and "MPF.Check man" write a roff man page built from the same command model as the help output. The page is emitted before any configuration handling so the roff stays clean for redirection to a file. Add a hand-maintained man page for the graphical frontend, which has no command-line model to generate from. Co-Authored-By: Claude Opus 4.8 --- CHANGELIST.md | 5 +++++ MPF.Avalonia/MPF.1 | 23 +++++++++++++++++++++++ MPF.CLI/Program.cs | 30 ++++++++++++++++++++++++++---- MPF.Check/Program.cs | 15 +++++++++++++++ 4 files changed, 69 insertions(+), 4 deletions(-) create mode 100644 MPF.Avalonia/MPF.1 diff --git a/CHANGELIST.md b/CHANGELIST.md index 4819a1c1d..54ffd3772 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -1,3 +1,8 @@ +### WIP (xxxx-xx-xx) + +- Add man page output to the command-line programs (gmipf) +- Add a man page for the graphical frontend (gmipf) + ### 3.8.2 (2026-07-01) - Output used configuration path for commandline programs diff --git a/MPF.Avalonia/MPF.1 b/MPF.Avalonia/MPF.1 new file mode 100644 index 000000000..399de3778 --- /dev/null +++ b/MPF.Avalonia/MPF.1 @@ -0,0 +1,23 @@ +.\" Manual page for the MPF graphical frontend. +.\" This page is maintained by hand. The command-line frontends generate +.\" their own pages with "MPF.CLI man" and "MPF.Check man". +.TH "MPF" "1" "" "" "User Commands" +.SH NAME +MPF \- graphical frontend for various dumping programs +.SH SYNOPSIS +.B MPF +.SH DESCRIPTION +MPF is the graphical component of the Media Preservation Frontend. It +provides a cross-platform interface for dumping optical media with programs +such as Redumper, Aaru, and DiscImageCreator, and for preparing the +resulting submission information. +.PP +The program is operated through its graphical interface. For scripted or +headless use, the command-line frontends provide the same dumping and +validation workflows. +.SH SEE ALSO +.BR MPF.CLI (1), +.BR MPF.Check (1) +.PP +Full documentation and source are available at +https://github.com/SabreTools/MPF diff --git a/MPF.CLI/Program.cs b/MPF.CLI/Program.cs index c6628d028..1b229ddb6 100644 --- a/MPF.CLI/Program.cs +++ b/MPF.CLI/Program.cs @@ -15,6 +15,18 @@ public class Program { public static void Main(string[] args) { + // Create the command set + var mainFeature = new MainFeature(); + var commandSet = CreateCommands(mainFeature); + + // The man page is rendered purely from the command model, so emit it + // before the configuration path and other startup output to keep the roff clean + if (args is not null && args.Length > 0 && commandSet.GetTopLevel(args[0]) is Manpage manpage) + { + manpage.ProcessArgs(args, 0, commandSet); + return; + } + // Load options from the config file var options = OptionsLoader.LoadFromConfig(out string? configPath); @@ -34,10 +46,6 @@ public static void Main(string[] args) return; } - // Create the command set - var mainFeature = new MainFeature(); - var commandSet = CreateCommands(mainFeature); - // If we have no args, show the help and quit if (args is null || args.Length == 0) { @@ -151,6 +159,7 @@ private static CommandSet CreateCommands(MainFeature mainFeature) // Standalone Options commandSet.Add(new Help()); + commandSet.Add(new Manpage(CreateManpageInfo())); commandSet.Add(new VersionFeature()); commandSet.Add(new ListCodesFeature()); commandSet.Add(new ListConfigFeature()); @@ -171,5 +180,18 @@ private static CommandSet CreateCommands(MainFeature mainFeature) return commandSet; } + + /// + /// Create the man page metadata for the program + /// + private static ManpageInfo CreateManpageInfo() + { + return new ManpageInfo("MPF.CLI") + { + Version = FrontendTool.GetCurrentVersion(), + Title = "User Commands", + Description = "CLI frontend for various dumping programs", + }; + } } } diff --git a/MPF.Check/Program.cs b/MPF.Check/Program.cs index 65f1ebbf0..64d722364 100644 --- a/MPF.Check/Program.cs +++ b/MPF.Check/Program.cs @@ -32,6 +32,7 @@ public static void Main(string[] args) { // Standalone Options case Help: BaseFeature.DisplayHelp(); return; + case Manpage manpage: manpage.ProcessArgs(args, 0, commandSet); return; case VersionFeature version: version.Execute(); return; case ListCodesFeature lc: lc.Execute(); return; case ListConfigFeature lc: lc.Execute(); return; @@ -133,6 +134,7 @@ private static CommandSet CreateCommands(MainFeature mainFeature) // Standalone Options commandSet.Add(new Help()); + commandSet.Add(new Manpage(CreateManpageInfo())); commandSet.Add(new VersionFeature()); commandSet.Add(new ListCodesFeature()); commandSet.Add(new ListConfigFeature()); @@ -167,5 +169,18 @@ private static CommandSet CreateCommands(MainFeature mainFeature) return commandSet; } + + /// + /// Create the man page metadata for the program + /// + private static ManpageInfo CreateManpageInfo() + { + return new ManpageInfo("MPF.Check") + { + Version = FrontendTool.GetCurrentVersion(), + Title = "User Commands", + Description = "Validator for various dumping programs", + }; + } } }