Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions CSharpRepl.Services/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ public sealed class Configuration

public const string PromptDefault = "> ";

public const string KeyBindingPatternDescription =
"Key pattern is a key with optional modifiers (Alt/Shift/Control) e.g. 'Enter', 'Control+A'";

public static readonly string ApplicationDirectory =
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), ".csharprepl");

Expand Down Expand Up @@ -212,8 +215,6 @@ internal static KeyPressPattern ParseKeyPressPattern(string keyPattern)
{
if (string.IsNullOrEmpty(keyPattern)) return default;

const string GeneralInfo = "Key pattern must contain one key with optional modifiers (Alt/Shift/Control). E.g. 'Enter', 'Control+A', '(', 'Alt+.', ...";

ConsoleKey? key = null;
char? keyChar = null;
ConsoleModifiers modifiers = default;
Expand All @@ -235,7 +236,7 @@ internal static KeyPressPattern ParseKeyPressPattern(string keyPattern)
}
else
{
throw new ArgumentException($"Unable to parse '{part}'. {GeneralInfo}", nameof(keyPattern));
throw new ArgumentException($"Unable to parse '{part}'. {KeyBindingPatternDescription}", nameof(keyPattern));
}
}

Expand All @@ -252,7 +253,7 @@ internal static KeyPressPattern ParseKeyPressPattern(string keyPattern)
return new KeyPressPattern(keyChar.Value);
}

static void Throw() => throw new ArgumentException(GeneralInfo, nameof(keyPattern));
static void Throw() => throw new ArgumentException(KeyBindingPatternDescription, nameof(keyPattern));

static bool TryParseConsoleModifiers(string text, out ConsoleModifiers result)
{
Expand Down
3 changes: 2 additions & 1 deletion CSharpRepl/Commands/CommandLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,8 @@ private static string GetHelp(string configFilePath)
$" [green]--tabSize[/] [cyan]<width>[/]: {TabSize.Description}" + NewLine +
$" [green]--culture[/] [cyan]<culture name>[/]: {Culture.Description}" + NewLine +
NewLine +
$" Key Bindings" + NewLine +
$" Key Bindings: {Configuration.KeyBindingPatternDescription}" + NewLine +
$" Specifying an option multiple times makes any of its key bindings trigger the action." + NewLine +
$" [green]--triggerCompletionListKeys[/] [cyan]<key-binding>[/]: {TriggerCompletionListKeyBindings.Description}" + NewLine +
$" [green]--newLineKeys[/] [cyan]<key-binding>[/]: {NewLineKeyBindings.Description}" + NewLine +
$" [green]--submitPromptKeys[/] [cyan]<key-binding>[/]: {SubmitPromptKeyBindings.Description}" + NewLine +
Expand Down
Loading