diff --git a/SmoulderingBeachBallCLI/ConsoleCommands.fs b/SmoulderingBeachBallCLI/ConsoleCommands.fs index 1499555..a8479b8 100644 --- a/SmoulderingBeachBallCLI/ConsoleCommands.fs +++ b/SmoulderingBeachBallCLI/ConsoleCommands.fs @@ -19,6 +19,16 @@ |> makeImage *) + let ``draw-default`` imgWidth imgHeight = + try + buildDefaultSpec imgWidth imgHeight + |> makeImage + |> Async.RunSynchronously + showEndOfCommandMessage + with + | :? ArgumentException as ex -> ex.Message + | _ as ex -> ex.Message + let ``draw-image`` imgWidth imgHeight mainColour path = try buildBasicSpec imgWidth imgHeight mainColour path diff --git a/SmoulderingBeachBallCLI/Validation.fs b/SmoulderingBeachBallCLI/Validation.fs index c897477..ea1d4a9 100644 --- a/SmoulderingBeachBallCLI/Validation.fs +++ b/SmoulderingBeachBallCLI/Validation.fs @@ -30,14 +30,28 @@ (String.Concat("[ERROR] The colour specifed is invalid.\n", "Please use the 'list-colours' command to see what you can use.")) + let getDesktopPath = + Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) + let parsePath (path: string) = match path with - | path when ((path.ToLower()).Equals "desktop") -> - Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) - | path when ((path.ToLower()).Equals "d") -> - Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) + | path when ((path.ToLower()).Equals "desktop") -> getDesktopPath + | path when ((path.ToLower()).Equals "d") -> getDesktopPath | _ -> path + let buildDefaultSpec iWidth iHeight = + let oSpec = + { colour = Brushes.Black + overlayType = Full } + let spec = + { width = iWidth + height = iHeight + colour = Brushes.AntiqueWhite + filePath = getDesktopPath + overlay = Some oSpec + } + spec + let buildBasicSpec iWidth iHeight mainColour path = let spec = { width = iWidth;