jupyter_kernel_1.0.0_8c987c13/sources/ada/magics-ls_magic.adb

 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
--  SPDX-FileCopyrightText: 2020 Max Reznik <reznikmm@gmail.com>
--
--  SPDX-License-Identifier: MIT
----------------------------------------------------------------

with Ada.Characters.Wide_Wide_Latin_1;

with League.JSON.Objects;
with League.JSON.Values;

with Jupyter.Kernels;

procedure Magics.Ls_Magic
  (IO_Pub : not null Jupyter.Kernels.IO_Pub_Access;
   Silent : Boolean)
is
   Result : League.Strings.Universal_String;
   Data   : League.JSON.Objects.JSON_Object;
begin
   if not Silent then
      Result.Append ("Available line magics:");
      Result.Append (Ada.Characters.Wide_Wide_Latin_1.LF);
      Result.Append ("%lsmagic? %%output? %%writefile? ");
      Result.Append ("%gargs? %cargs? %largs? %bargs?");

      Data.Insert (+"text/plain", League.JSON.Values.To_JSON_Value (Result));
      IO_Pub.Execute_Result
        (Data      => Data,
         Metadata  => League.JSON.Objects.Empty_JSON_Object,
         Transient => League.JSON.Objects.Empty_JSON_Object);
   end if;
end Magics.Ls_Magic;