Commit 32758139 authored by Michael Siegel's avatar Michael Siegel 👔
Browse files

Implement prototype option parsing; add some structuring comments

parent e72d0902
......@@ -3,7 +3,7 @@
--
-- a ____ to facilitate random note-taking -- rewrite…
--
-- Version 0.28.7
-- Version 0.29.0
--
--
-- Copyright 2021 Michael Siegel
......@@ -37,7 +37,7 @@ procedure Mote is
Program_Name : constant String := "mote";
Invocation_Name : constant String := Simple_Name(Command_Name);
Program_Version : constant String := "0.28.7";
Program_Version : constant String := "0.29.0";
Base_Dir : constant String := Env_Vars.Value("HOME") & "/.mote_R";
Data_Dir : constant String := Base_Dir & "/notes";
......@@ -48,6 +48,13 @@ procedure Mote is
-------- GLOBAL PARAMETERS --------
Arg : Unbounded_String;
Verbosity : Natural := 0;
-------- EXCEPTIONS --------
Parse_Error : exception;
-------- AUXILIARY SUBPROGRAMS --------
function Base36_To_Dec (Base36_String : String) return Natural is
......@@ -147,5 +154,36 @@ procedure Mote is
Put_Line(Program_Name & " " & Program_Version);
end Show_Version;
begin
null;
-- Environment checks
-- Parse configuration file
-- Parse command-line arguments
if Argument_Count = 0 then
raise Parse_Error with "missing command";
else
-- Global options and option-arguments
for N in 1..Argument_Count loop
Arg := To_Unbounded_String(Argument(N));
if Arg = "-v" then
Verbosity := 1;
elsif Arg = "--help" then
Show_Help;
exit; -- but exit the whole program…
elsif Arg = "--version" then
Show_Version;
exit;
elsif Arg = "--" then
exit;
else
null;
end if;
end loop;
-- Commands
end if;
end Mote;
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