|
|
|
@ -6,15 +6,34 @@
|
|
|
|
|
open Validation |
|
|
|
|
open System.IO |
|
|
|
|
open Console.Waterworks |
|
|
|
|
open Console.Waterworks.Attributes |
|
|
|
|
|
|
|
|
|
let showEndOfCommandMessage = "[INFO.] Task completed." |
|
|
|
|
|
|
|
|
|
[<ListCommand>] |
|
|
|
|
[<Parameters "none">] |
|
|
|
|
[<Description |
|
|
|
|
"Display a text message indicating this program is running properly.">] |
|
|
|
|
[<Usage "test">] |
|
|
|
|
let test () = "[SUCCESS] Death Socket is working." |
|
|
|
|
|
|
|
|
|
[<ListCommand>] |
|
|
|
|
[<Parameters "none">] |
|
|
|
|
[<Description "Displays a list of available commands provided by this program.">] |
|
|
|
|
[<Usage "help">] |
|
|
|
|
let help () = CW_Liaison().RequestHelpDocumentation("Commands") |
|
|
|
|
|
|
|
|
|
[<ListCommand>] |
|
|
|
|
[<Parameters "none">] |
|
|
|
|
[<Description "Exits out of the program.">] |
|
|
|
|
[<Usage "exit">] |
|
|
|
|
let exit () = Environment.Exit (Environment.ExitCode) |
|
|
|
|
|
|
|
|
|
[<ListCommand>] |
|
|
|
|
[<Parameters "(image-path: string) (new-path: string)">] |
|
|
|
|
[<Description |
|
|
|
|
"Takes the image at 'image-path' applies a 10x10 grid (in white) to it and saves the result at 'new-path'.">] |
|
|
|
|
[<Usage "add-default C:/base-image.png C:/final-image.png">] |
|
|
|
|
let ``add-default`` imgPath newPath = |
|
|
|
|
try |
|
|
|
|
printfn "[INFO.] Adding default grid to image..." |
|
|
|
@ -27,6 +46,13 @@
|
|
|
|
|
| :? ArgumentException as ex -> "[ERROR] Invalid argument: " + ex.Message |
|
|
|
|
| _ as ex -> ex.Message |
|
|
|
|
|
|
|
|
|
[<ListCommand>] |
|
|
|
|
[<Parameters |
|
|
|
|
("(image-path: string) (no-of-rows: int) (no-of-columns: int) " + |
|
|
|
|
"(pen-width: float32) (colour: string) (new-path: string)")>] |
|
|
|
|
[<Description "Adds a grid to an image, using the specified parameters, and saves it.">] |
|
|
|
|
[<Usage |
|
|
|
|
"add-grid C:/orignal-image.png 10 5 2 red C:/new-image.png">] |
|
|
|
|
let ``add-grid`` imgPath numRows numColumns pWidth colour newPath = |
|
|
|
|
try |
|
|
|
|
printfn "[INFO.] Adding grid to image..." |
|
|
|
@ -39,6 +65,11 @@
|
|
|
|
|
| :? ArgumentException as ex -> "[ERROR] Invalid argument: " + ex.Message |
|
|
|
|
| _ as ex -> ex.Message |
|
|
|
|
|
|
|
|
|
[<ListCommand>] |
|
|
|
|
[<Parameters "none">] |
|
|
|
|
[<Description |
|
|
|
|
"Lists out the colours this program uses to draw its grids.">] |
|
|
|
|
[<Usage "list-colours">] |
|
|
|
|
let ``list-colours`` () = |
|
|
|
|
printfn "[INFO.] Listing available colours..." |
|
|
|
|
for item in colourList do |
|
|
|
|