Home / Class/ ShellCommandRunner Class — spring-boot Architecture

ShellCommandRunner Class — spring-boot Architecture

Architecture documentation for the ShellCommandRunner class in Shell.java from the spring-boot codebase.

Entity Profile

Relationship Graph

Source Code

cli/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/Shell.java lines 187–231

	private static class ShellCommandRunner extends CommandRunner {

		private volatile @Nullable Command lastCommand;

		private final Map<String, String> aliases = new HashMap<>();

		ShellCommandRunner() {
			super(null);
		}

		void addAliases(String command, String... aliases) {
			for (String alias : aliases) {
				this.aliases.put(alias, command);
			}
		}

		@Override
		public @Nullable Command findCommand(String name) {
			if (name.startsWith("!")) {
				return new RunProcessCommand(name.substring(1));
			}
			if (this.aliases.containsKey(name)) {
				name = this.aliases.get(name);
			}
			return super.findCommand(name);
		}

		@Override
		protected void beforeRun(Command command) {
			this.lastCommand = command;
		}

		@Override
		protected void afterRun(Command command) {
		}

		boolean handleSigInt() {
			Command command = this.lastCommand;
			if (command instanceof RunProcessCommand runProcessCommand) {
				return runProcessCommand.handleSigInt();
			}
			return false;
		}

	}

Domain

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free