Skip to content

Commit

Permalink
Stop forcing a trailing space on prompt strings
Browse files Browse the repository at this point in the history
Partly because the mix of space or no space in the code is odd, and partly
because Terminal::LineEditor::CLIInput doesn't need it forced.
  • Loading branch information
japhb committed Oct 24, 2021
1 parent 89f4869 commit ede5b28
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions lib/MUGS/App/CLI.rakumod
Expand Up @@ -56,11 +56,11 @@ class MUGS::App::CLI is MUGS::App::LocalUI {
}

method prompt-for-password(Str:D $prompt = 'Password') {
$!input.prompt(self.styled-prompt("$prompt: "), :mask<*>);
$!input.prompt(self.styled-prompt("$prompt:"), :mask<*>);
}

method text-input(Str:D $label, Str :$default) {
my $styled = self.styled-prompt($default ?? "$label [$default]: " !! "$label: ");
my $styled = self.styled-prompt($default ?? "$label [$default]:" !! "$label:");
my $input;
until $input {
my $raw = $!input.prompt($styled);
Expand All @@ -82,7 +82,7 @@ class MUGS::App::CLI is MUGS::App::LocalUI {

my $option;
until $option {
my $new-option = $!input.prompt(self.styled-prompt("Selection: "));
my $new-option = $!input.prompt(self.styled-prompt("Selection:"));
return unless $new-option.defined;
$new-option .= trim;
if $new-option ~~ /^ \d+ $/ && 1 <= $new-option <= @options {
Expand Down
2 changes: 1 addition & 1 deletion lib/MUGS/UI/CLI.rakumod
Expand Up @@ -21,7 +21,7 @@ class Game is MUGS::UI::Game {
has Bool $.screen-reader; #= Tune output for screen readers

method ui-type() { 'CLI' }
method prompt-string() { '> ' }
method prompt-string() { '>' }
method is-lobby() { False }
method game-help() { ... }

Expand Down
2 changes: 1 addition & 1 deletion lib/MUGS/UI/CLI/Game/Echo.rakumod
Expand Up @@ -8,7 +8,7 @@ use MUGS::UI::CLI::Genre::Test;
#| UI for echo test
class MUGS::UI::CLI::Game::Echo is MUGS::UI::CLI::Genre::Test {
method game-type() { 'echo' }
method prompt-string() { 'Enter a message > ' }
method prompt-string() { 'Enter a message >' }

method show-initial-state(::?CLASS:D:) { }
method show-echo($response) { $.app-ui.put-sanitized($response.data<echo>) }
Expand Down
2 changes: 1 addition & 1 deletion lib/MUGS/UI/CLI/Game/Lobby.rakumod
Expand Up @@ -15,7 +15,7 @@ class MUGS::UI::CLI::Game::Lobby is MUGS::UI::CLI::Game {
has State $.state = State(0);

method game-type() { 'lobby' }
method prompt-string() { %prompts{$.state} ~ ' > ' }
method prompt-string() { %prompts{$.state} ~ ' >' }
method is-lobby() { True }

method show-available-game-types(::?CLASS:D: Bool :$all) {
Expand Down
2 changes: 1 addition & 1 deletion lib/MUGS/UI/CLI/Game/NumberGuess.rakumod
Expand Up @@ -10,7 +10,7 @@ class MUGS::UI::CLI::Game::NumberGuess is MUGS::UI::CLI::Genre::Guessing {

method prompt-string(::?CLASS:D:) {
my ($min, $max) = $.client.initial-state< min max >;
"Enter a natural number between $min and $max > "
"Enter a natural number between $min and $max >"
}

method guess-status($response) {
Expand Down
2 changes: 1 addition & 1 deletion lib/MUGS/UI/CLI/Game/Snowman.rakumod
Expand Up @@ -7,7 +7,7 @@ use MUGS::UI::CLI::Genre::Guessing;
#| CLI for Snowman word guessing game
class MUGS::UI::CLI::Game::Snowman is MUGS::UI::CLI::Genre::Guessing {
method game-type() { 'snowman' }
method prompt-string() { 'Enter a letter in this word > ' }
method prompt-string() { 'Enter a letter in this word >' }

method guess-status($response) {
"Guess {$response.data<turns>} was "
Expand Down
2 changes: 1 addition & 1 deletion lib/MUGS/UI/CLI/Genre/Guessing.rakumod
Expand Up @@ -7,7 +7,7 @@ use MUGS::UI::CLI;

#| CLI for guessing games
class MUGS::UI::CLI::Genre::Guessing is MUGS::UI::CLI::Game {
method prompt-string() { 'Next guess > ' }
method prompt-string() { 'Next guess >' }
method guess-status($response) { ... }
method game-status($response) { '' }
method winloss-status($response) {
Expand Down

0 comments on commit ede5b28

Please sign in to comment.