@ Override public boolean readBoolean ( String message , Boolean defaultValue ) throws IOException { saveCursorPosition ( ) ; Ansi style = ansi ( ) ; if ( getTheme ( ) . getPromptBackground ( ) != null ) { style . bg ( getTheme ( ) . getPromptBackground ( ) ) ; } if ( getTheme ( ) . getPromptForeground ( ) != null ) { style . fg ( getTheme ( ) . getPromptForeground ( ) ) ; } for ( int i = 1 ; i <= getFooterSize ( ) ; i ++ ) { console . out ( ) . print ( ansi ( ) . cursor ( terminal . getHeight ( ) - getFooterSize ( ) + i , 1 ) ) ; console . out ( ) . print ( style . eraseLine ( Ansi . Erase . FORWARD ) ) ; } console . out ( ) . print ( ansi ( ) . cursor ( terminal . getHeight ( ) , 1 ) ) ; console . out ( ) . print ( style . a ( message ) . bold ( ) . eraseLine ( Ansi . Erase . FORWARD ) ) ; restoreCursorPosition ( ) ; flush ( ) ; try { EditorOperation operation ; while ( true ) { operation = readOperation ( ) ; switch ( operation . getType ( ) ) { case NEWLINE : return defaultValue ; case TYPE : if ( "y" . equals ( operation . getInput ( ) ) || "Y" . equals ( operation . getInput ( ) ) ) { return true ; } else if ( "n" . equals ( operation . getInput ( ) ) || "N" . equals ( operation . getInput ( ) ) ) { return false ; } } } } finally { redrawFooter ( ) ; } }
Displays a message and reads a boolean from the user input . The mapping of the user input to a boolean value is specified by the implementation .