From 86342d0bdd78cc18ee280610742e46a1d434295c Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Fri, 14 Apr 2017 16:35:25 -0400 Subject: [PATCH] server is now called shell server command is renamed to shell, and the old shell command is called oldshell. --- .../src/main/scala/sbt/BasicCommandStrings.scala | 6 +++--- main-command/src/main/scala/sbt/BasicCommands.scala | 6 +++--- main/src/main/scala/sbt/Main.scala | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/main-command/src/main/scala/sbt/BasicCommandStrings.scala b/main-command/src/main/scala/sbt/BasicCommandStrings.scala index dcdd4d4d1..f944cb5f6 100644 --- a/main-command/src/main/scala/sbt/BasicCommandStrings.scala +++ b/main-command/src/main/scala/sbt/BasicCommandStrings.scala @@ -150,10 +150,10 @@ $AliasCommand name= Removes the alias for `name`.""" def Shell = "shell" - def ShellDetailed = "Provides an interactive prompt from which commands can be run." + def ShellDetailed = "Provides an interactive prompt and network server from which commands can be run." - def Server = "server" - def ServerDetailed = "Provides a network server and an interactive prompt from which commands can be run." + def OldShell = "oldshell" + def OldShellDetailed = "Provides an interactive prompt from which commands can be run." def Client = "client" def ClientDetailed = "Provides an interactive prompt from which commands can be run on a server." diff --git a/main-command/src/main/scala/sbt/BasicCommands.scala b/main-command/src/main/scala/sbt/BasicCommands.scala index c6033d812..ece1197ac 100644 --- a/main-command/src/main/scala/sbt/BasicCommands.scala +++ b/main-command/src/main/scala/sbt/BasicCommands.scala @@ -29,7 +29,7 @@ import scala.util.control.NonFatal object BasicCommands { lazy val allBasicCommands: Seq[Command] = Seq( nop, ignore, help, completionsCommand, multi, ifLast, append, setOnFailure, clearOnFailure, - stashOnFailure, popOnFailure, reboot, call, early, exit, continuous, history, shell, client, + stashOnFailure, popOnFailure, reboot, call, early, exit, continuous, history, oldshell, client, read, alias ) ++ compatCommands @@ -202,7 +202,7 @@ object BasicCommands { } } - def shell: Command = Command.command(Shell, Help.more(Shell, ShellDetailed)) { s => + def oldshell: Command = Command.command(OldShell, Help.more(Shell, OldShellDetailed)) { s => val history = (s get historyPath) getOrElse Some(new File(s.baseDir, ".history")) val prompt = (s get shellPrompt) match { case Some(pf) => pf(s); case None => "> " } val reader = new FullReader(history, s.combinedParser) @@ -211,7 +211,7 @@ object BasicCommands { case Some(line) => val newState = s.copy( onFailure = Some(Exec(Shell, None)), - remainingCommands = Exec(line, s.source) +: Exec(Shell, None) +: s.remainingCommands + remainingCommands = Exec(line, s.source) +: Exec(OldShell, None) +: s.remainingCommands ).setInteractive(true) if (line.trim.isEmpty) newState else newState.clearGlobalLog case None => s.setInteractive(false) diff --git a/main/src/main/scala/sbt/Main.scala b/main/src/main/scala/sbt/Main.scala index 2e31bfdc3..873d938b2 100644 --- a/main/src/main/scala/sbt/Main.scala +++ b/main/src/main/scala/sbt/Main.scala @@ -31,7 +31,7 @@ import java.net.URI import java.util.Locale import scala.util.control.NonFatal -import BasicCommandStrings.{ Shell, Server } +import BasicCommandStrings.{ Shell, OldShell } import CommandStrings.BootCommand /** This class is the entry point for sbt. */ @@ -92,7 +92,7 @@ final class xMain extends xsbti.AppMain { private def endsWithBoot(state: State) = state.remainingCommands.lastOption exists (_.commandLine == BootCommand) private def notifyUsersAboutShell(state: State) = - if (isInteractive && !hasCommand(state, Shell) && !hasCommand(state, Server) && !endsWithBoot(state)) { + if (isInteractive && !hasCommand(state, Shell) && !hasCommand(state, OldShell) && !endsWithBoot(state)) { state.log warn "Executing in batch mode." state.log warn " For better performance, hit [ENTER] to switch to interactive mode, or" state.log warn " consider launching sbt without any commands, or explicitly passing 'shell'" @@ -168,7 +168,7 @@ object BuiltinCommands { templateCommand, projects, project, reboot, read, history, set, sessionCommand, inspect, loadProjectImpl, loadFailed, Cross.crossBuild, Cross.switchVersion, Cross.crossRestoreSession, setOnFailure, clearOnFailure, stashOnFailure, popOnFailure, - setLogLevel, plugin, plugins, ifLast, multi, shell, server, BasicCommands.client, + setLogLevel, plugin, plugins, ifLast, multi, shell, oldshell, BasicCommands.client, continuous, eval, alias, append, last, lastGrep, export, boot, nop, call, exit, early, initialize, act ) ++ compatCommands @@ -614,13 +614,13 @@ object BuiltinCommands { s.put(Keys.stateCompilerCache, cache) } - def server: Command = Command.command(Server, Help.more(Server, ServerDetailed)) { s0 => + def shell: Command = Command.command(Shell, Help.more(Shell, ShellDetailed)) { s0 => import sbt.internal.{ ConsolePromptEvent, ConsoleUnpromptEvent } val exchange = StandardMain.exchange val s1 = exchange run s0 exchange publishEventMessage ConsolePromptEvent(s0) val exec: Exec = exchange.blockUntilNextExec - val newState = s1.copy(onFailure = Some(Exec(Server, None)), remainingCommands = exec +: Exec(Server, None) +: s1.remainingCommands).setInteractive(true) + val newState = s1.copy(onFailure = Some(Exec(Shell, None)), remainingCommands = exec +: Exec(Shell, None) +: s1.remainingCommands).setInteractive(true) exchange publishEventMessage ConsoleUnpromptEvent(exec.source) if (exec.commandLine.trim.isEmpty) newState else newState.clearGlobalLog