namespace Commands module ConsoleCommands = open System open DeathSocket.GridPainter open DeathSocketCLI.Validation open System.IO open Console.Waterworks open Console.Waterworks.Attributes open DeathSocket.Domain let showEndOfCommandMessage = "[INFO.] Task completed." [] [] [] [] let test () = "[SUCCESS] Death Socket is working." [] [] [] [] let help () = CW_Liaison().RequestHelpDocumentation("Commands") [] [] [] [] let exit () = Environment.Exit (Environment.ExitCode) [] [] [] [] let ``add-default`` imgPath newPath greyScale= try printfn "[INFO.] Adding default grid to image..." Brush (buildDefaultSpec imgPath newPath) |> applyGridToImageAsync greyScale |> Async.Start showEndOfCommandMessage with | :? FileNotFoundException as ex -> "[ERROR] No file was found at " + ex.FileName | :? ArgumentException as ex -> "[ERROR] Invalid argument: " + ex.Message | _ as ex -> ex.Message [] [] [] [] let ``add-grid`` imgPath numRows numColumns pWidth colour newPath greyScale = try printfn "[INFO.] Adding grid to image..." Brush (buildSpec imgPath numRows numColumns pWidth colour newPath) |> applyGridToImageAsync greyScale |> Async.Start showEndOfCommandMessage with | :? FileNotFoundException as ex -> "[ERROR] No file was found at " + ex.FileName | :? ArgumentException as ex -> "[ERROR] Invalid argument: " + ex.Message | _ as ex -> ex.Message [] [] [] [] let ``list-colours`` () = printfn "[INFO.] Listing available colours..." for item in colourList do printfn "%s" item.Key showEndOfCommandMessage (* ALIASES ======================================================================= These command-methods will not show up in the help section. Before adding extra aliases, make sure the main version is as clear and helpful to someone new to the program as possible. Aliases should be treated as commands for experienced users and documented on the wiki, hosted alongside the repository on GitHub. URL: https://github.com/CraigOates/Death-Socket/wiki *) let ad imgPath newPath greyScale = ``add-default`` imgPath newPath greyScale let ag imgPath numRows numColumns pWidth colour newPath greyScale = ``add-grid`` imgPath numRows numColumns pWidth colour newPath greyScale let lc () = ``list-colours`` () (* SkiaSharp Command-Methods -- NOT FOR MASS CONSUMPTION ======================================================================= These command-methods will not show up in the help section. These command-methods are here for testing purposes. They mimic the command- methods above, apart from using SkiaSharp. So, including these command- methods will create a sense of duplicated functionality. Seeing as you are reading this, it is assumed you can understand it. If so, please feel free to use them -- just keep their exposure to a minimum.*) let ``list-skia-colours`` () = printfn "[INFO.] Listing available SkiaSharp colours..." for item in skiaColourList do printfn "%s" item.Key showEndOfCommandMessage let``add-skia-grid`` imgPath numRows numColumns pWidth colour newPath greyScale= printfn "[INFO.] Adding SkiaSharp grid to image..." Skia (buildSkiaSpec imgPath numRows numColumns pWidth colour newPath) |> applyGridToImageAsync greyScale |> Async.Start showEndOfCommandMessage let``add-skia-rgb-grid`` imgPath numRows numColumns pWidth r g b newPath greyScale = printfn "[INFO.] Adding SkiaSharp grid to image..." SkiaRGB (buildSkiaRGBSpec imgPath numRows numColumns pWidth r g b newPath) |> applyGridToImageAsync greyScale |> Async.Start showEndOfCommandMessage