You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
77 lines
3.3 KiB
77 lines
3.3 KiB
namespace Commands |
|
module ConsoleCommands = |
|
|
|
open System |
|
open Console.Waterworks |
|
open Console.Waterworks.Attributes |
|
open FunkyFish // This is where the "LibraryTest" functions are -- in BFLib |
|
|
|
[<ListCommand>] |
|
[<Description "Display a message to the console signifying the program is running as intended.">] |
|
[<Parameters "none">] |
|
[<Usage "> test">] |
|
let test() = "The console is working" |
|
|
|
[<ListCommand>] |
|
[<Description "Closes the program.">] |
|
[<Parameters "none">] |
|
[<Usage "> exit">] |
|
let exit() = System.Environment.Exit(Environment.ExitCode) |
|
|
|
[<ListCommand>] |
|
[<Description "Display a list of available commands, info. about the command, its parameters and an example of how to use it.">] |
|
[<Parameters "None">] |
|
[<Usage "> help">] |
|
let help() = |
|
let liaison = CW_Liaison() |
|
liaison.RequestHelpDocumentation("Commands") |
|
|
|
[<ListCommand>] |
|
[<Description "Adds the two numbers together.">] |
|
[<Parameters "x:int y:int">] |
|
[<Usage "> libtest1 5 10">] |
|
let libtest1 x y = String.Format("Result: {0}" , LibraryTest1 x y) |
|
|
|
[<ListCommand>] |
|
[<Description "Multiplies x and y together then mulitplies that by z or... (x * y) * z">] |
|
[<Parameters "x:int y:int z:int">] |
|
[<Usage "> libtest2 5 10 2">] |
|
let libtest2 x y z = String.Format("Result: {0}", (LibraryTest2 x y z)) |
|
|
|
[<ListCommand>] |
|
[<Description "Appends the named passed into the console onto \"Hello\" and displays it in the console.">] |
|
[<Parameters "name: string">] |
|
[<Usage "> libtest3 \"Craig Oates\"">] |
|
let libtest3 name = String.Format("Result: {0}", LibraryTest3 name) |
|
|
|
[<ListCommand>] |
|
[<Description "Displays a message in the console, signfying the command-method is working.">] |
|
[<Parameters "none">] |
|
[<Usage "> test 1">] |
|
let ``test 1``() = "Result: Test 1 working" |
|
|
|
[<ListCommand>] |
|
[<Description "Displays a message in the console, signfying the command-method is working. The command uses F#'s double back-tick notation -- hence the command name and usage example not matching up.">] |
|
[<Parameters "none">] |
|
[<Usage "> test 2">] |
|
let ``test-2``() = "Result: Test 2 working" |
|
// This only works when you type "test 2" not ideal but better then nothing |
|
|
|
[<ListCommand>] |
|
[<Description "Displays a message in the console, signfying the command-method is working.">] |
|
[<Parameters "none">] |
|
[<Usage "> test 3">] |
|
let """test 3""" = "Result: Test 3 working" |
|
(*This is not displayed in the help section, regardless of the attributes. |
|
It still works if you enter the command into the console, though.*) |
|
|
|
[<ListCommand>] |
|
[<Description "Displays a message in the console, signfying the command-method is working.">] |
|
[<Parameters "none">] |
|
[<Usage "> test 4">] |
|
let """test-4""" = "Result: Test 4 working" |
|
(* This only works when you type "test 4" not ideal but better then nothing. |
|
This is not displayed in the help section, regardless of the attributes. |
|
It still works if you enter the command in the console, though.*) |
|
|
|
|
|
|