with Ada.Text_IO;
with Ada.Command_Line;
 
procedure Args is
   package IO renames Ada.Text_IO;
   package CLI renames Ada.Command_Line;
   More_Than_One_Arg : constant CLI.Exit_Status := 3;
begin
   IO.Put_Line (Item => "Argument Count:" & CLI.Argument_Count'Img);
   if CLI.Argument_Count = 0 then
      CLI.Set_Exit_Status (Code => CLI.Failure);
   elsif CLI.Argument_Count = 1 then
      CLI.Set_Exit_Status (Code => CLI.Success);
   else
      CLI.Set_Exit_Status (Code => More_Than_One_Arg);
   end if; 
end Args;

Go back


Navigation