Skip to content

Commit 2c44369

Browse files
committed
Cleaned up style
1 parent bba46f2 commit 2c44369

2 files changed

Lines changed: 18 additions & 22 deletions

File tree

src/spectrecoff-cli/commands/Prompt.fs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ open SpectreCoff
66
type PromptSettings() =
77
inherit CommandSettings()
88

9-
type Value = {
10-
num: int
11-
description: string
12-
}
9+
type Value =
10+
{ num: int
11+
description: string }
1312

1413
type PromptExample() =
1514
inherit Command<PromptSettings>()
@@ -40,7 +39,7 @@ type PromptExample() =
4039

4140
if (amount = amountAgain)
4241
then "You didn't flinch, huh?"
43-
else $"I see you changed your mind ..."
42+
else "I see you changed your mind ..."
4443
|> printMarkedUp
4544

4645
let answer = confirm $"Do you want to eat them right away?"
@@ -50,16 +49,17 @@ type PromptExample() =
5049
|> toConsole
5150

5251
// example for chooseFromValues
53-
let getDescription (value: Value): string =
52+
let getDescription (value: Value) =
5453
value.description
54+
5555
let values = [
56-
{num = 42; description = "the answer" }
57-
{num = 13; description = "some say it's unlucky" }
58-
]
56+
{ num = 42; description = "the answer" }
57+
{ num = 13; description = "some say it's unlucky" }
58+
]
59+
5960
let chosenValue = chooseFromValues getDescription values "Which number do you like best from its description?"
60-
sprintf "I like %i, too" chosenValue.num
61+
$"I like {chosenValue.num}, too"
6162
|> printMarkedUp
62-
6363
0
6464

6565
type PromptDocumentation() =

src/spectrecoff/Prompt.fs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@ open Spectre.Console
55

66
type PromptOptions =
77
{ Secret: bool
8-
Optional: bool
9-
}
8+
Optional: bool }
109

1110
type MultiSelectionPromptOptions =
1211
{ PageSize: int }
1312

14-
let defaultOptions = { Secret = false; Optional = false; }
15-
let defaultMultiSelectionOptions = { PageSize = 10; }
13+
let defaultOptions =
14+
{ Secret = false
15+
Optional = false }
16+
17+
let defaultMultiSelectionOptions =
18+
{ PageSize = 10; }
1619

1720
[<RequireQualifiedAccess>]
1821
module private Prompts =
@@ -52,13 +55,6 @@ let private prompt prompter =
5255
let chooseFrom (choices: string list) question =
5356
prompt (Prompts.selectionPrompt question choices)
5457

55-
56-
/// <summary>Choose from typed values</summary>
57-
/// <param name="converter">function to convert each value to a string that gets displayed in the prompt</param>
58-
/// <param name="values">typed values to choose from</param>
59-
/// <param name="question">question prompt</param>
60-
/// <typeparam name="'T">Type of values</typeparam>
61-
/// <returns>the chosen value of type 'T</returns>
6258
let chooseFromValues<'T> (converter : 'T -> string) (values: 'T list) question =
6359
prompt (Prompts.selectionPromptT converter question values)
6460

0 commit comments

Comments
 (0)