From 039971f920c5a3647a33dcee0ded0100c9319223 Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Fri, 5 Nov 2021 01:04:29 +1300 Subject: Verbosity now sufficiently verbose --- src/deck_convert.adb | 41 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/src/deck_convert.adb b/src/deck_convert.adb index 3d8d953..3b15a2f 100644 --- a/src/deck_convert.adb +++ b/src/deck_convert.adb @@ -91,7 +91,7 @@ begin GCom.Define_Switch (Config => Config, Output => Format_Arg'Access, Switch => "-t:", Long_Switch => "--type=", - Help => "format of output data, valid options are CSV or FMD"); + Help => "format of output data, valid options are CSV or FMD, default is FMD"); GCom.Define_Switch (Config => Config, Output => Input_Arg'Access, @@ -109,7 +109,7 @@ begin Usage => "[switches]", Help => "Utility to convert Anki flashcard decks to Fresh Memory dictionaries." & Latin.LF & - "At minimum the type, input, and output options are required." & Latin.LF); + "At minimum input and output options are required." & Latin.LF); begin @@ -127,7 +127,7 @@ begin if Format_Arg.all = "" then if Verbose then Put_Line (Standard_Error, "WARNING: No output deck format selected. " & - "Proceeding with FMD as default."); + "Proceeding with FMD as default." & Latin.LF); end if; Deck_Format := +"fmd"; else @@ -176,20 +176,55 @@ begin -- Program functionality proper starts here + if Verbose then + Put (Standard_Error, "Opening input deck database..."); + end if; Deck_IO.Open_Database (-Input_Name, Deck); + if Verbose then + Put_Line (Standard_Error, " Done"); + Put (Standard_Error, "Querying models..."); + end if; Deck_IO.Query_Models (Deck, Models); + if Verbose then + Put_Line (Standard_Error, " Done"); + Put (Standard_Error, "Querying notes..."); + end if; Deck_IO.Query_Notes (Deck, Notes); + if Verbose then + Put_Line (Standard_Error, " Done"); + Put (Standard_Error, "Closing database..."); + end if; Deck_IO.Close_Database (Deck); + if Verbose then + Put_Line (Standard_Error, " Done"); + New_Line (Standard_Error); + end if; declare Contain_Dir : String := FD.Containing_Directory (-Output_Name); Simple_Name : String := FD.Simple_Name (-Output_Name); begin if Deck_Format = "csv" then + if Verbose then + Put (Standard_Error, "Writing output to CSV..."); + end if; Deck_IO.Write_CSV (Contain_Dir, Simple_Name, Models, Notes, Overwrite); + if Verbose then + Put_Line (Standard_Error, " Done"); + end if; elsif Deck_Format = "fmd" then + if Verbose then + Put (Standard_Error, "Reading media..."); + end if; Deck_IO.Read_Media_Map (-Input_Name, Media); + if Verbose then + Put_Line (Standard_Error, " Done"); + Put (Standard_Error, "Writing output to Fresh Memory Dictionary..."); + end if; Deck_IO.Write_FMD (Contain_Dir, Simple_Name, Models, Notes, Media, Overwrite); + if Verbose then + Put_Line (Standard_Error, " Done"); + end if; else raise Constraint_Error; end if; -- cgit