Commit 0c9150d0 authored by Michael Siegel's avatar Michael Siegel 👔
Browse files

Port `_show_help` (WIP)

For reasons to be explained elsewhere, the new `Show_Help` function has been
limited to printing a usage summary.
parent de426b07
......@@ -22,6 +22,7 @@
--
with Ada.Command_Line; use Ada.Command_Line;
with Ada.Containers.Indefinite_Vectors;
with Ada.Text_IO; use Ada.Text_IO;
procedure Mote is
......@@ -29,6 +30,36 @@ procedure Mote is
Invocation_Name : constant String := Command_Name; -- Cut `*/`.
Program_Version : constant String := "0.1.0-ada";
procedure Show_Help is
-- Display help text
-- Provide per-command help text, depending on what sub-command was run,
-- and "global" help only when 'help' is run or when 'missing command'.
package String_Vector is new Ada.Containers.Indefinite_Vectors
(Index_Type => Positive,
Element_Type => String);
use String_Vector;
Line_Prefix : String := " " & Invocation_Name;
Synopses : constant String_Vector.Vector :=
String_Vector.Empty_Vector
& "browse [-C] [-I] [-T] [-e] [-i] [-r RANGE] [PATTERN...]"
& "clean"
& "delete [-C] [-I] [-T] [-e] [-i] [-r RANGE] [PATTERN...]"
& "edit [-C] [-I] [-T] [-e] [-i] [-r RANGE] [PATTERN...]"
& "find [-C] [-I] [-T] [-e] [-i] [-r RANGE] [PATTERN...]"
& "merge [-n] [-q] SOURCE... TARGET"
& "new [TITLE]"
& "rebuild"
& "stats"
& "help"
& "version";
begin
Put_Line("Usage:");
for L of Synopses loop
Put_Line(Line_Prefix & " " & L);
end loop;
end Show_Help;
procedure Show_Version is
begin
Put_Line(Program_Name & " " & Program_Version);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment