Class Shell


  • public class Shell
    extends Object
    Command shell for ML, powered by JLine3.
    • Field Detail

      • terminal

        private final org.jline.terminal.Terminal terminal
    • Constructor Detail

      • Shell

        public Shell​(Shell.Config config,
                     org.jline.terminal.Terminal terminal)
        Creates a Shell.
    • Method Detail

      • main

        public static void main​(String[] args)
        Command-line entry point.
        Parameters:
        args - Command-line arguments
      • pause

        protected final void pause()
        Pauses after creating the terminal.

        Calls the value set by Shell.Config.withPauseFn(Runnable) which, for the default config, does nothing; the instance used in testing pauses for a few milliseconds, which gives classes time to load and makes test deterministic.

      • canIgnoreLine

        private static boolean canIgnoreLine​(StringBuilder buf,
                                             String line)
        Returns whether we can ignore a line. We can ignore a line if it consists only of comments, spaces, and optionally semicolon, and if we are not on a continuation line.
      • banner

        private String banner()
        Generates a banner to be shown on startup.
      • run

        public void run()
      • instantiate

        @Nonnull
        private static <T> T instantiate​(String className,
                                         Class<T> clazz)
        Instantiates a class.

        Assumes that the class has a public no-arguments constructor.