getada_1.0.1_e3e93ee6/src/defaults.ads

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
--    Copyright (C) 2022-2024 A.J. Ianozi <aj@ianozi.com>
--
--    This file is part of GetAda: the Unofficial Alire Installer
--
--    This program is free software: you can redistribute it and/or modify
--    it under the terms of the GNU General Public License as published by
--    the Free Software Foundation, either version 3 of the License, or
--    (at your option) any later version.
--
--    This program is distributed in the hope that it will be useful,
--    but WITHOUT ANY WARRANTY; without even the implied warranty of
--    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
--    GNU General Public License for more details.
--
--    You should have received a copy of the GNU General Public License
--    along with this program.  If not, see <https://www.gnu.org/licenses/>.

with Ada.Characters.Latin_1;
package Defaults is
   --  Exceptions
   Invalid_Version, Invalid_Download, Invalid_File, No_Environment_Variable,
   Platform_Not_Yet_Supported, User_Aborted, Graceful_Exit,
   Missing_Dependency : exception;

   --  About GetAda
   Getada_Version : constant String := "1.0.0"; --  Must match alire.toml

   --  Directories, starting at root.
   Tmp_Dir  : constant String := "/tmp"; --  Location in temporary directory

   --  Directories, starting at $HOME
   Cfg_Dir  : constant String := "/.getada"; --  Config, scripts, bin
   Bin_Dir  : constant String := "/bin";     --  Located in Cfg_Dir
   Log_File : constant String := "/log.dat"; --  Located in Cfg_Dir

   --  Environmental Variables
   Tmp_Env : constant String := "TMPDIR";               --  Override Tmp_Dir
   Cfg_Env : constant String := "GETADA_CFG";           --  Override Cfg_Dir
   Bin_Env : constant String := "GETADA_BIN";           --  Override Bin_Dir
   Ver_Env : constant String := "GETADA_ALIRE_VERSION"; --  Override latest ver

   --  Alire binary file
   Alire_Command : constant String := "alr";
   --  Getada binary file
   Getada_Command : constant String := "getada";

   --  Messages
   NL : constant String :=
     Ada.Characters.Latin_1.CR & Ada.Characters.Latin_1.LF;

   Welcome_Message : constant String :=
     "Welcome to the unofficial Alire Installer (""GetAda"") v" &
     Getada_Version & "!" & NL &
     "Alire is the official Ada Package Manager. For more information" & NL &
     "please visit https://ada-lang.io or https://alire.ada.dev" & NL &
     "Copyright (C) 2022-2024 A.J. Ianozi licensed GPL3.";

   Help_Message : constant String :=
     "Options: " & NL &
     "-h --help: Print this message and exit." & NL &
     "-v --version: Print the version of this binary and exit." & NL &
     "-p --no-path: Don't update path." & NL &
     "-n --non-interactive: Suppress prompts; answer with defaults." & NL &
     "-q --quiet: Be quiet (does not suppress propmts)" & NL &
     "-t /directory --tmp=/directory: Location of tmp directory " & NL &
     "-c /directory --cfg=/directory: Set config directory " & NL &
     "-b /directory --bin=/directory: Set binary directory " & NL &
     "-a x.y.z --alire-version=x.y.z: Download version x.y.z of alire." & NL &
     "-u --uninstall: Uninstall Alire. This only works if Alire was" & NL &
     "                installed with GetAda.  Works out of the box if" & NL &
     "                default directory was used, otherwise you must" & NL &
     "                pass --cfg= so the uninstaller can find the log." & NL &
     "You can also set the version and tmp/cfg/binary directories by " & NL &
     "setting the following environment variables:" & NL &
     " * """ & Ver_Env & """ for Alire's version" & NL &
     " * """ & Tmp_Env & """ for location of temp directory" & NL &
     " * """ & Cfg_Env & """ for config directory" & NL &
     " * """ & Bin_Env & """ for binary directory" & NL &
     "That's it for right now!";

end Defaults;