Skip to content

Commit 2e3a520

Browse files
authored
Print UTF-8 strings using GNAT.IO in Alr.Commands subsystem (#1458)
Supersedes #1457 Fixes #1456
1 parent 428064e commit 2e3a520

File tree

4 files changed

+18
-17
lines changed

4 files changed

+18
-17
lines changed

src/alr/alr-commands-init.adb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ package body Alr.Commands.Init is
368368
Info.Name := To_Unbounded_String (Tentative_Name);
369369
exit;
370370
else
371-
Ada.Text_IO.Put_Line
371+
Put_Line
372372
("Invalid crate name '"
373373
& Tentative_Name & "': "
374374
& Alire.Error_In_Name (Tentative_Name));
@@ -406,13 +406,13 @@ package body Alr.Commands.Init is
406406
if SPDX.Valid (SP) then
407407
return True;
408408
else
409-
Ada.Text_IO.Put_Line
409+
Put_Line
410410
("Invalid SPDX license expression '" & Str
411411
& "': " & SPDX.Error (SP));
412-
Ada.Text_IO.Put_Line
412+
Put_Line
413413
("SPDX expression expected (https://spdx.org/licenses/).");
414-
Ada.Text_IO.Put_Line ("(Use 'custom-' prefix for custom"
415-
& " license identifier)");
414+
Put_Line ("(Use 'custom-' prefix for custom"
415+
& " license identifier)");
416416

417417
return False;
418418
end if;
@@ -487,9 +487,9 @@ package body Alr.Commands.Init is
487487
function Description_Validation (Str : String) return Boolean is
488488
begin
489489
if Str'Length > Alire.Max_Description_Length then
490-
Ada.Text_IO.Put_Line ("Description too long:"
491-
& Str'Length'Img & " (max"
492-
& Alire.Max_Description_Length'Img & ")");
490+
Put_Line ("Description too long:"
491+
& Str'Length'Img & " (max"
492+
& Alire.Max_Description_Length'Img & ")");
493493
return False;
494494
else
495495
return True;
@@ -527,7 +527,7 @@ package body Alr.Commands.Init is
527527
Tag_Error : constant String := Alire.Utils.Error_In_Tag (Elt);
528528
begin
529529
if Tag_Error /= "" then
530-
Ada.Text_IO.Put_Line (Tag_Error);
530+
Put_Line (Tag_Error);
531531
Tags_Ok := False;
532532
end if;
533533
end;

src/alr/alr-commands-run.adb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ package body Alr.Commands.Run is
2424

2525
procedure Check_Report (Cmd : in out Command;
2626
Exe_Name : String) is
27-
use Ada.Text_IO;
2827

2928
Found_At : constant AAA.Strings.Vector :=
3029
Files.Locate_File_Under (Cmd.Root.Path,

src/alr/alr-commands.adb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ with Ada.Characters.Handling; use Ada.Characters.Handling;
22
with Ada.Command_Line;
33
with Ada.Directories;
44
with Ada.Environment_Variables;
5-
with Ada.Text_IO; use Ada.Text_IO;
65

76
with CLIC.TTY;
87
with CLIC.User_Input;

src/alr/alr-commands.ads

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ with Alire.Version;
77

88
with CLIC.Subcommand;
99

10-
private with Ada.Text_IO;
10+
private with GNAT.IO;
1111
private with CLIC.Subcommand.Instance;
1212

1313
private with Alr.OS_Lib; -- For the benefit of many child packages that use it
@@ -122,11 +122,14 @@ private
122122

123123
-- Common generalities
124124

125-
procedure New_Line (Spacing : Ada.Text_IO.Positive_Count := 1)
126-
renames Ada.Text_IO.New_Line;
125+
procedure New_Line (Spacing : Positive := 1)
126+
renames GNAT.IO.New_Line;
127127

128128
procedure Put_Line (S : String)
129-
renames Ada.Text_IO.Put_Line;
129+
renames GNAT.IO.Put_Line;
130+
131+
procedure Put (S : String)
132+
renames GNAT.IO.Put;
130133

131134
procedure Put_Error (Str : String);
132135
procedure Set_Global_Switches
@@ -135,8 +138,8 @@ private
135138
package Sub_Cmd is new CLIC.Subcommand.Instance
136139
(Main_Command_Name => "alr",
137140
Version => Alire.Version.Current,
138-
Put => Ada.Text_IO.Put,
139-
Put_Line => Ada.Text_IO.Put_Line,
141+
Put => GNAT.IO.Put,
142+
Put_Line => GNAT.IO.Put_Line,
140143
Put_Error => Put_Error,
141144
Error_Exit => OS_Lib.Bailout,
142145
Set_Global_Switches => Set_Global_Switches,

0 commit comments

Comments
 (0)