mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-09-30 00:56:56 +13:00
Rework script building
This commit is contained in:
parent
b16cb3ee59
commit
63269bbbfb
1 changed files with 9 additions and 7 deletions
|
@ -52,24 +52,26 @@ public class ScriptHelper {
|
|||
public static String constructInitFile(ShellDialect t, ShellControl processControl, List<String> init, String toExecuteInShell, boolean login, String displayName)
|
||||
throws Exception {
|
||||
String nl = t.getNewLine().getNewLineString();
|
||||
var content = String.join(nl, init.stream().filter(s -> s != null).toList()) + nl;
|
||||
|
||||
if (displayName != null) {
|
||||
content = t.changeTitleCommand(displayName) + "\n" + content;
|
||||
}
|
||||
var content = "";
|
||||
|
||||
var applyRcCommand = t.applyRcFileCommand();
|
||||
if (applyRcCommand != null) {
|
||||
content = content + "\n" + applyRcCommand + "\n";
|
||||
content = content + nl + applyRcCommand + nl;
|
||||
}
|
||||
|
||||
// We just apply the profile files always, as we can't be sure that they definitely have been applied.
|
||||
// Especially if we launch something that is not the system default shell
|
||||
var applyProfilesCommand = t.applyProfileFilesCommand();
|
||||
if (applyProfilesCommand != null) {
|
||||
content = content + "\n" + applyProfilesCommand + "\n";
|
||||
content = content + nl + applyProfilesCommand + nl;
|
||||
}
|
||||
|
||||
if (displayName != null) {
|
||||
content = t.changeTitleCommand(displayName) + nl + content;
|
||||
}
|
||||
|
||||
content += String.join(nl, init.stream().filter(s -> s != null).toList()) + nl;
|
||||
|
||||
if (toExecuteInShell != null) {
|
||||
// Normalize line endings
|
||||
content += String.join(nl, toExecuteInShell.lines().toList()) + nl;
|
||||
|
|
Loading…
Reference in a new issue