public boolean assist ( ) { // Read the command line and provide assistance for the command line before the caret. final String commandLine = commandLineManager . getCommandLine ( ) ; final int caret = commandLineManager . getCaret ( ) ; final String commandLineToAssist = commandLine . substring ( 0 , caret ) ; final Opt < String > autoCompletedSuffix = shell . assist ( commandLineToAssist ) ; if ( ! autoCompletedSuffix . isPresent ( ) ) { return false ; } // Don't overwrite any extra characters on the command line that came after the caret. final String extraCommandLine = commandLine . substring ( caret ) ; final String autoCompletedCommandLine = commandLineToAssist + autoCompletedSuffix . get ( ) ; commandLineManager . setCommandLine ( autoCompletedCommandLine + extraCommandLine ) ; commandLineManager . setCaret ( autoCompletedCommandLine . length ( ) ) ; return true ; }
Provide assistance for the command line .