Make indexing logs rewrite themselves
authorEkaterina Vaartis <vaartis@kotobank.ch>
Sun, 22 Aug 2021 20:47:43 +0000 (23:47 +0300)
committerFloatingGhost <hannah@coffee-and-dreams.uk>
Wed, 29 Jun 2022 19:48:29 +0000 (20:48 +0100)
lib/mix/tasks/pleroma/search/meilisearch.ex

index b5a394e34929821f87ec931c406cb04c6fa5dc16..2485a441d8e1e152051bd12c8aaf70bc20f3d7d9 100644 (file)
@@ -57,7 +57,9 @@ defmodule Mix.Tasks.Pleroma.Search.Meilisearch do
         |> Stream.transform(0, fn objects, acc ->
           new_acc = acc + Enum.count(objects)
 
-          IO.puts("Indexed #{new_acc} entries")
+          # Reset to the beginning of the line and rewrite it
+          IO.write("\r")
+          IO.write("Indexed #{new_acc} entries")
 
           {[objects], new_acc}
         end)
@@ -76,6 +78,8 @@ defmodule Mix.Tasks.Pleroma.Search.Meilisearch do
       end,
       timeout: :infinity
     )
+
+    IO.write("\n")
   end
 
   def run(["clear"]) do