-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Amendments made (suggested refactoring). Change in the base class of …
…commands: now BaseCommand does not contain the "showHelpText" option, it was replaced with "noLogo" because the library can automatically handle the "help" option. All requests for help are translated into an error stream
- Loading branch information
Showing
12 changed files
with
77 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace O21.CommandLine.Tests | ||
|
||
open O21.CommandLine | ||
|
||
type MockConsole() = | ||
member val InfoItems = ResizeArray<string>() | ||
member val ErrorItems = ResizeArray<string>() | ||
interface IConsole with | ||
member this.ReportInfo(text:string) = this.InfoItems.Add(text) | ||
member this.ReportError(text:string) = this.ErrorItems.Add(text) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
namespace O21.CommandLine | ||
|
||
[<Interface>] | ||
type IReporter = | ||
type IConsole = | ||
abstract member ReportInfo: string -> unit | ||
abstract member ReportError: string -> unit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
namespace O21.Game | ||
|
||
open System | ||
open System.Text | ||
open O21.CommandLine | ||
|
||
type CommandLineReporter() = | ||
interface IReporter with | ||
type SystemConsole() = | ||
do Console.OutputEncoding <- Encoding.UTF8 | ||
interface IConsole with | ||
member this.ReportInfo(text:string) = printfn $"%s{text}" | ||
member this.ReportError(text:string) = | ||
Console.ForegroundColor <- ConsoleColor.Red | ||
printfn $"%s{text}" | ||
Console.ForegroundColor <- ConsoleColor.White | ||
member public this.ReportInfo(text:string) = (this :> IReporter).ReportInfo text | ||
member public this.ReportError(text:string) = (this :> IReporter).ReportError text |