Browse Source

add draw-default command-method.

Add function for building a default image spec in CLI.
master
Craig Oates 6 years ago
parent
commit
7723d54b70
  1. 10
      SmoulderingBeachBallCLI/ConsoleCommands.fs
  2. 22
      SmoulderingBeachBallCLI/Validation.fs

10
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

22
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;

Loading…
Cancel
Save