Class Shell

java.lang.Object
org.springframework.shell.Shell

public class Shell extends Object
Main class implementing a shell loop.
  • Field Details

    • NO_INPUT

      public static final Object NO_INPUT
      Marker object returned to signify that there was no input to turn into a command execution.
    • completionResolvers

      protected List<CompletionResolver> completionResolvers
    • UNRESOLVED

      protected static final Object UNRESOLVED
      Marker object to distinguish unresolved arguments from null, which is a valid value.
  • Constructor Details

  • Method Details

    • setCompletionResolvers

      @Autowired public void setCompletionResolvers(List<CompletionResolver> resolvers)
    • setArgumentResolvers

      @Autowired public void setArgumentResolvers(CommandExecution.CommandExecutionHandlerMethodArgumentResolvers argumentResolvers)
    • setConversionService

      public void setConversionService(org.springframework.core.convert.ConversionService shellConversionService)
    • setValidatorFactory

      @Autowired(required=false) public void setValidatorFactory(jakarta.validation.ValidatorFactory validatorFactory)
    • setExceptionResolvers

      @Autowired(required=false) public void setExceptionResolvers(List<CommandExceptionResolver> exceptionResolvers)
    • setExitCodeExceptionProvider

      @Autowired(required=false) public void setExitCodeExceptionProvider(ExitCodeExceptionProvider exitCodeExceptionProvider)
    • run

      public void run(InputProvider inputProvider) throws Exception
      The main program loop: acquire input, try to match it to a command and evaluate. Repeat until a ResultHandler causes the process to exit or there is no input.

      This method has public visibility so that it can be invoked by actual commands (e.g. a script command).

      Throws:
      Exception
    • evaluate

      protected Object evaluate(Input input)
      Evaluate a single "line" of input from the user by trying to map words to a command and arguments.

      This method does not throw exceptions, it catches them and returns them as a regular result

    • complete

      public List<CompletionProposal> complete(CompletionContext context)
      Gather completion proposals given some (incomplete) input the user has already typed in. When and how this method is invoked is implementation specific and decided by the actual user interface.