mirror of
https://github.com/fankes/termux-app.git
synced 2025-09-06 10:45:23 +08:00
Changed: Maintain terminal session name in ExecutionCommand.sessionName
in addition to TerminalSession.mSessionName
This commit is contained in:
@@ -148,9 +148,12 @@ public class ExecutionCommand {
|
||||
*/
|
||||
public Integer backgroundCustomLogLevel;
|
||||
|
||||
/** The session action of foreground commands. */
|
||||
|
||||
/** The session action of {@link Runner#TERMINAL_SESSION} commands. */
|
||||
public String sessionAction;
|
||||
|
||||
/** The session name of {@link Runner#TERMINAL_SESSION} commands. */
|
||||
public String sessionName;
|
||||
|
||||
/** The command label for the {@link ExecutionCommand}. */
|
||||
public String commandLabel;
|
||||
@@ -343,6 +346,9 @@ public class ExecutionCommand {
|
||||
if (!ignoreNull || executionCommand.sessionAction != null)
|
||||
logString.append("\n").append(executionCommand.getSessionActionLogString());
|
||||
|
||||
if (!ignoreNull || executionCommand.sessionName != null) {
|
||||
logString.append("\n").append(executionCommand.getSessionNameLogString());
|
||||
}
|
||||
if (!ignoreNull || executionCommand.commandIntent != null)
|
||||
logString.append("\n").append(executionCommand.getCommandIntentLogString());
|
||||
|
||||
@@ -434,6 +440,7 @@ public class ExecutionCommand {
|
||||
}
|
||||
|
||||
markdownString.append("\n").append(MarkdownUtils.getSingleLineMarkdownStringEntry("Session Action", executionCommand.sessionAction, "-"));
|
||||
markdownString.append("\n").append(MarkdownUtils.getSingleLineMarkdownStringEntry("Session Name", executionCommand.sessionName, "-"));
|
||||
|
||||
|
||||
markdownString.append("\n").append(MarkdownUtils.getSingleLineMarkdownStringEntry("isPluginExecutionCommand", executionCommand.isPluginExecutionCommand, "-"));
|
||||
@@ -524,6 +531,9 @@ public class ExecutionCommand {
|
||||
return Logger.getSingleLineLogStringEntry("Session Action", sessionAction, "-");
|
||||
}
|
||||
|
||||
public String getSessionNameLogString() {
|
||||
return Logger.getSingleLineLogStringEntry("Session Name", sessionName, "-");
|
||||
}
|
||||
public String getCommandDescriptionLogString() {
|
||||
return Logger.getSingleLineLogStringEntry("Command Description", commandDescription, "-");
|
||||
}
|
||||
|
@@ -54,7 +54,6 @@ public class TermuxSession {
|
||||
* @param terminalSessionClient The {@link TerminalSessionClient} interface implementation.
|
||||
* @param termuxSessionClient The {@link TermuxSessionClient} interface implementation.
|
||||
* @param shellEnvironmentClient The {@link ShellEnvironmentClient} interface implementation.
|
||||
* @param sessionName The optional {@link TerminalSession} name.
|
||||
* @param setStdoutOnExit If set to {@code true}, then the {@link ResultData#stdout}
|
||||
* available in the {@link TermuxSessionClient#onTermuxSessionExited(TermuxSession)}
|
||||
* callback will be set to the {@link TerminalSession} transcript. The session
|
||||
@@ -67,7 +66,7 @@ public class TermuxSession {
|
||||
public static TermuxSession execute(@NonNull final Context context, @NonNull ExecutionCommand executionCommand,
|
||||
@NonNull final TerminalSessionClient terminalSessionClient, final TermuxSessionClient termuxSessionClient,
|
||||
@NonNull final ShellEnvironmentClient shellEnvironmentClient,
|
||||
final String sessionName, final boolean setStdoutOnExit) {
|
||||
final boolean setStdoutOnExit) {
|
||||
if (executionCommand.workingDirectory == null || executionCommand.workingDirectory.isEmpty())
|
||||
executionCommand.workingDirectory = shellEnvironmentClient.getDefaultWorkingDirectoryPath();
|
||||
if (executionCommand.workingDirectory.isEmpty())
|
||||
@@ -132,8 +131,8 @@ public class TermuxSession {
|
||||
Logger.logDebug(LOG_TAG, "Running \"" + executionCommand.getCommandIdAndLabelLogString() + "\" TermuxSession");
|
||||
TerminalSession terminalSession = new TerminalSession(executionCommand.executable, executionCommand.workingDirectory, executionCommand.arguments, environment, executionCommand.terminalTranscriptRows, terminalSessionClient);
|
||||
|
||||
if (sessionName != null) {
|
||||
terminalSession.mSessionName = sessionName;
|
||||
if (executionCommand.sessionName != null) {
|
||||
terminalSession.mSessionName = executionCommand.sessionName;
|
||||
}
|
||||
|
||||
return new TermuxSession(terminalSession, executionCommand, termuxSessionClient, setStdoutOnExit);
|
||||
|
Reference in New Issue
Block a user