Script improvements

This commit is contained in:
crschnick 2024-07-27 21:48:48 +00:00
parent ccb018a522
commit 0014bf6165
19 changed files with 152 additions and 147 deletions

View file

@ -2,10 +2,40 @@ package io.xpipe.app.browser.action;
import io.xpipe.app.browser.file.BrowserEntry;
import io.xpipe.app.browser.fs.OpenFileSystemModel;
import io.xpipe.app.util.LicenseProvider;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuItem;
import org.kordamp.ikonli.javafx.FontIcon;
import java.util.List;
public interface BranchAction extends BrowserAction {
List<LeafAction> getBranchingActions(OpenFileSystemModel model, List<BrowserEntry> entries);
default MenuItem toMenuItem(OpenFileSystemModel model, List<BrowserEntry> selected) {
var m = new Menu(getName(model, selected).getValue() + " ...");
for (var sub : getBranchingActions(model, selected)) {
var subselected = resolveFilesIfNeeded(selected);
if (!sub.isApplicable(model, subselected)) {
continue;
}
m.getItems().add(sub.toMenuItem(model, subselected));
}
var graphic = getIcon(model, selected);
if (graphic != null) {
m.setGraphic(graphic);
}
m.setDisable(!isActive(model, selected));
if (getProFeatureId() != null
&& !LicenseProvider.get()
.getFeature(getProFeatureId())
.isSupported()) {
m.setDisable(true);
m.setGraphic(new FontIcon("mdi2p-professional-hexagon"));
}
return m;
}
List<? extends BrowserAction> getBranchingActions(OpenFileSystemModel model, List<BrowserEntry> entries);
}

View file

@ -7,6 +7,7 @@ import io.xpipe.core.util.ModuleLayerLoader;
import javafx.beans.value.ObservableValue;
import javafx.scene.Node;
import javafx.scene.control.MenuItem;
import javafx.scene.input.KeyCombination;
import java.util.ArrayList;
@ -19,13 +20,17 @@ public interface BrowserAction {
static List<LeafAction> getFlattened(OpenFileSystemModel model, List<BrowserEntry> entries) {
return ALL.stream()
.map(browserAction -> browserAction instanceof LeafAction
? List.of((LeafAction) browserAction)
: ((BranchAction) browserAction).getBranchingActions(model, entries))
.map(browserAction -> getFlattened(browserAction, model, entries))
.flatMap(List::stream)
.toList();
}
static List<LeafAction> getFlattened(BrowserAction browserAction, OpenFileSystemModel model, List<BrowserEntry> entries) {
return browserAction instanceof LeafAction
? List.of((LeafAction) browserAction)
: ((BranchAction) browserAction).getBranchingActions(model, entries).stream().map(action -> getFlattened(action, model, entries)).flatMap(List::stream).toList();
}
static LeafAction byId(String id, OpenFileSystemModel model, List<BrowserEntry> entries) {
return getFlattened(model, entries).stream()
.filter(browserAction -> id.equals(browserAction.getId()))
@ -33,6 +38,17 @@ public interface BrowserAction {
.orElseThrow();
}
default List<BrowserEntry> resolveFilesIfNeeded(List<BrowserEntry> selected) {
return automaticallyResolveLinks()
? selected.stream()
.map(browserEntry ->
new BrowserEntry(browserEntry.getRawFileEntry().resolved(), browserEntry.getModel()))
.toList()
: selected;
}
MenuItem toMenuItem(OpenFileSystemModel model, List<BrowserEntry> selected);
default void init(OpenFileSystemModel model) throws Exception {}
default String getProFeatureId() {

View file

@ -1,19 +1,12 @@
package io.xpipe.app.browser.file;
import io.xpipe.app.browser.action.BranchAction;
import io.xpipe.app.browser.action.BrowserAction;
import io.xpipe.app.browser.action.LeafAction;
import io.xpipe.app.browser.fs.OpenFileSystemModel;
import io.xpipe.app.core.AppFont;
import io.xpipe.app.util.InputHelper;
import io.xpipe.app.util.LicenseProvider;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.Menu;
import javafx.scene.control.SeparatorMenuItem;
import org.kordamp.ikonli.javafx.FontIcon;
import java.util.ArrayList;
import java.util.List;
@ -30,15 +23,6 @@ public final class BrowserContextMenu extends ContextMenu {
createMenu();
}
private static List<BrowserEntry> resolveIfNeeded(BrowserAction action, List<BrowserEntry> selected) {
return action.automaticallyResolveLinks()
? selected.stream()
.map(browserEntry ->
new BrowserEntry(browserEntry.getRawFileEntry().resolved(), browserEntry.getModel()))
.toList()
: selected;
}
private void createMenu() {
InputHelper.onLeft(this, false, e -> {
hide();
@ -60,7 +44,7 @@ public final class BrowserContextMenu extends ContextMenu {
var all = BrowserAction.ALL.stream()
.filter(browserAction -> browserAction.getCategory() == cat)
.filter(browserAction -> {
var used = resolveIfNeeded(browserAction, selected);
var used = browserAction.resolveFilesIfNeeded(selected);
if (!browserAction.isApplicable(model, used)) {
return false;
}
@ -81,36 +65,8 @@ public final class BrowserContextMenu extends ContextMenu {
}
for (BrowserAction a : all) {
var used = resolveIfNeeded(a, selected);
if (a instanceof LeafAction la) {
getItems().add(la.toMenuItem(model, used));
}
if (a instanceof BranchAction la) {
var m = new Menu(a.getName(model, used).getValue() + " ...");
for (LeafAction sub : la.getBranchingActions(model, used)) {
var subUsed = resolveIfNeeded(sub, selected);
if (!sub.isApplicable(model, subUsed)) {
continue;
}
m.getItems().add(sub.toMenuItem(model, subUsed));
}
var graphic = a.getIcon(model, used);
if (graphic != null) {
m.setGraphic(graphic);
}
m.setDisable(!a.isActive(model, used));
if (la.getProFeatureId() != null
&& !LicenseProvider.get()
.getFeature(la.getProFeatureId())
.isSupported()) {
m.setDisable(true);
m.setGraphic(new FontIcon("mdi2p-professional-hexagon"));
}
getItems().add(m);
}
var used = a.resolveFilesIfNeeded(selected);
getItems().add(a.toMenuItem(model, used));
}
}
}

View file

@ -9,7 +9,6 @@ import io.xpipe.app.prefs.AppPrefs;
import io.xpipe.app.util.TerminalLauncher;
import io.xpipe.core.process.CommandBuilder;
import io.xpipe.core.process.ShellControl;
import javafx.beans.value.ObservableValue;
import java.util.List;
@ -28,14 +27,18 @@ public abstract class MultiExecuteAction implements BranchAction {
model.withShell(
pc -> {
for (BrowserEntry entry : entries) {
var cmd = pc.command(createCommand(pc, model, entry));
if (cmd == null) {
continue;
}
TerminalLauncher.open(
model.getEntry().getEntry(),
entry.getRawFileEntry().getName(),
model.getCurrentDirectory() != null
? model.getCurrentDirectory()
.getPath()
: null,
pc.command(createCommand(pc, model, entry)));
: null, cmd);
}
},
false);
@ -61,7 +64,12 @@ public abstract class MultiExecuteAction implements BranchAction {
model.withShell(
pc -> {
for (BrowserEntry entry : entries) {
pc.command(createCommand(pc, model, entry))
var cmd = createCommand(pc, model, entry);
if (cmd == null) {
continue;
}
pc.command(cmd)
.withWorkingDirectory(model.getCurrentDirectory()
.getPath())
.execute();

View file

@ -2,27 +2,23 @@ package io.xpipe.ext.base.script;
import io.xpipe.app.browser.action.BranchAction;
import io.xpipe.app.browser.action.BrowserAction;
import io.xpipe.app.browser.action.LeafAction;
import io.xpipe.app.browser.file.BrowserEntry;
import io.xpipe.app.browser.fs.OpenFileSystemModel;
import io.xpipe.app.browser.session.BrowserSessionModel;
import io.xpipe.app.core.AppI18n;
import io.xpipe.app.issue.ErrorEvent;
import io.xpipe.app.storage.DataStorage;
import io.xpipe.app.util.ScriptHelper;
import io.xpipe.core.process.CommandBuilder;
import io.xpipe.core.process.ShellControl;
import io.xpipe.core.store.FilePath;
import io.xpipe.ext.base.browser.MultiExecuteAction;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.value.ObservableValue;
import javafx.scene.Node;
import org.kordamp.ikonli.javafx.FontIcon;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class RunScriptAction implements BrowserAction, BranchAction {
@ -69,43 +65,39 @@ public class RunScriptAction implements BrowserAction, BranchAction {
}
@Override
public List<LeafAction> getBranchingActions(OpenFileSystemModel model, List<BrowserEntry> entries) {
public List<BranchAction> getBranchingActions(OpenFileSystemModel model, List<BrowserEntry> entries) {
var sc = model.getFileSystem().getShell().orElseThrow();
var scripts = getInstances(sc);
List<LeafAction> actions = scripts.entrySet().stream()
List<BranchAction> actions = scripts.entrySet().stream()
.map(e -> {
return new LeafAction() {
@Override
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) throws Exception {
var args = entries.stream()
.map(browserEntry -> new FilePath(browserEntry
.getRawFileEntry()
.getPath())
.quoteIfNecessary())
.collect(Collectors.joining(" "));
execute(model, args);
}
private void execute(OpenFileSystemModel model, String args) throws Exception {
if (model.getBrowserModel() instanceof BrowserSessionModel bm) {
var content = e.getValue().assemble(sc);
var script = ScriptHelper.createExecScript(sc, content);
try {
sc.executeSimpleCommand(
sc.getShellDialect().runScriptCommand(sc, script.toString()) + " " + args);
} catch (Exception ex) {
throw ErrorEvent.expected(ex);
}
}
}
return new MultiExecuteAction() {
@Override
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
return new SimpleStringProperty(e.getKey());
}
@Override
protected CommandBuilder createCommand(ShellControl sc, OpenFileSystemModel model, BrowserEntry entry) {
if (!(model.getBrowserModel() instanceof BrowserSessionModel bm)) {
return null;
}
var content = e.getValue().assemble(sc);
var script = ScriptHelper.createExecScript(sc, content);
var builder = CommandBuilder.of().add(sc.getShellDialect().runScriptCommand(sc, script.toString()));
entries.stream()
.map(browserEntry -> browserEntry
.getRawFileEntry()
.getPath())
.forEach(s -> {
builder.addFile(s);
});
return builder;
}
};
})
.map(leafAction -> (LeafAction) leafAction)
.map(leafAction -> (BranchAction) leafAction)
.toList();
return actions;
}

View file

@ -80,7 +80,6 @@ lockCreationAlertHeader=Set your new master passphrase
#context: verb, exit
finish=Finish
error=An error occurred
#force
downloadStageDescription=Moves downloaded files into your system downloads directory and opens it.
ok=Ok
search=Search

View file

@ -154,9 +154,9 @@ serviceHostDescription=Den vært, som tjenesten kører på
openWebsite=Åben hjemmeside
customServiceGroup.displayName=Service-gruppe
customServiceGroup.displayDescription=Gruppér flere tjenester i én kategori
initScript=Kører på shell init
shellScript=Gør script tilgængeligt under shell-session
fileScript=Gør det muligt at kalde et script med filargumenter i filbrowseren
initScript=Init-script - køres ved shell-init
shellScript=Sessionsscript - Gør scriptet tilgængeligt under en shell-session
fileScript=Filscript - Gør det muligt at kalde et script med filargumenter i filbrowseren
runScript=Kør script
copyUrl=Kopier URL
fixedServiceGroup.displayName=Service-gruppe
@ -164,7 +164,7 @@ fixedServiceGroup.displayDescription=Liste over tilgængelige tjenester på et s
mappedService.displayName=Service
mappedService.displayDescription=Interagere med en tjeneste, der er eksponeret af en container
customService.displayName=Service
customService.displayDescription=Tilføj en brugerdefineret tjeneste til tunnel og åben
customService.displayDescription=Tilføj en ekstern serviceport til tunnel til din lokale maskine
fixedService.displayName=Service
fixedService.displayDescription=Brug en foruddefineret tjeneste
noServices=Ingen tilgængelige tjenester

View file

@ -145,9 +145,9 @@ serviceHostDescription=Der Host, auf dem der Dienst läuft
openWebsite=Website öffnen
customServiceGroup.displayName=Dienstgruppe
customServiceGroup.displayDescription=Mehrere Dienste in einer Kategorie zusammenfassen
initScript=Auf der Shell init ausführen
shellScript=Skript während der Shell-Sitzung verfügbar machen
fileScript=Skriptaufruf mit Dateiargumenten im Dateibrowser zulassen
initScript=Init-Skript - Wird beim Shell-Init ausgeführt
shellScript=Sitzungsskript - Skript während der Shell-Sitzung verfügbar machen
fileScript=Dateiskript - Erlaubt den Aufruf eines Skripts mit Dateiargumenten im Dateibrowser
runScript=Skript ausführen
copyUrl=URL kopieren
fixedServiceGroup.displayName=Dienstgruppe
@ -155,7 +155,7 @@ fixedServiceGroup.displayDescription=Liste der verfügbaren Dienste auf einem Sy
mappedService.displayName=Dienst
mappedService.displayDescription=Interaktion mit einem Dienst, der von einem Container angeboten wird
customService.displayName=Dienst
customService.displayDescription=Einen benutzerdefinierten Dienst zum Tunnel hinzufügen und öffnen
customService.displayDescription=Hinzufügen eines Remote Service Ports zum Tunneln zu deinem lokalen Rechner
fixedService.displayName=Dienst
fixedService.displayDescription=Einen vordefinierten Dienst verwenden
noServices=Keine verfügbaren Dienste

View file

@ -143,9 +143,9 @@ serviceHostDescription=The host the service is running on
openWebsite=Open website
customServiceGroup.displayName=Service group
customServiceGroup.displayDescription=Group multiple services into one category
initScript=Run on shell init
shellScript=Make script available during shell session
fileScript=Allow script to be called with file arguments in the file browser
initScript=Init script - Run on shell init
shellScript=Session script - Make script available during shell session
fileScript=File script - Allow script to be called with file arguments in the file browser
runScript=Run script
copyUrl=Copy URL
fixedServiceGroup.displayName=Service group
@ -153,7 +153,7 @@ fixedServiceGroup.displayDescription=List the available services on a system
mappedService.displayName=Service
mappedService.displayDescription=Interact with a service exposed by a container
customService.displayName=Service
customService.displayDescription=Add a custom service to tunnel and open
customService.displayDescription=Add a remote service port to tunnel to you local machine
fixedService.displayName=Service
fixedService.displayDescription=Use a predefined service
noServices=No available services

View file

@ -143,9 +143,9 @@ serviceHostDescription=El host en el que se ejecuta el servicio
openWebsite=Abrir sitio web
customServiceGroup.displayName=Grupo de servicios
customServiceGroup.displayDescription=Agrupa varios servicios en una categoría
initScript=Ejecutar en shell init
shellScript=Hacer que el script esté disponible durante la sesión shell
fileScript=Permitir llamar a un script con argumentos de archivo en el explorador de archivos
initScript=Script de init - Se ejecuta en el shell init
shellScript=Script de sesión - Hacer que el script esté disponible durante la sesión shell
fileScript=Script de archivo - Permite llamar al script con argumentos de archivo en el explorador de archivos
runScript=Ejecutar script
copyUrl=Copiar URL
fixedServiceGroup.displayName=Grupo de servicios
@ -153,7 +153,7 @@ fixedServiceGroup.displayDescription=Enumerar los servicios disponibles en un si
mappedService.displayName=Servicio
mappedService.displayDescription=Interactúa con un servicio expuesto por un contenedor
customService.displayName=Servicio
customService.displayDescription=Añade un servicio personalizado para tunelizar y abrir
customService.displayDescription=Añade un puerto de servicio remoto para hacer un túnel hacia tu máquina local
fixedService.displayName=Servicio
fixedService.displayDescription=Utilizar un servicio predefinido
noServices=No hay servicios disponibles

View file

@ -143,9 +143,9 @@ serviceHostDescription=L'hôte sur lequel le service est exécuté
openWebsite=Ouvrir un site web
customServiceGroup.displayName=Groupe de service
customServiceGroup.displayDescription=Regrouper plusieurs services dans une même catégorie
initScript=Exécute sur le shell init
shellScript=Rendre le script disponible pendant la session shell
fileScript=Permet d'appeler un script avec des arguments de fichier dans le navigateur de fichiers
initScript=Script d'initialisation - Exécuté lors de l'initialisation de l'interpréteur de commandes
shellScript=Script de session - Rendre le script disponible pendant la session de l'interpréteur de commandes
fileScript=Script de fichier - Permet d'appeler un script avec des arguments de fichier dans le navigateur de fichiers
runScript=Exécuter un script
copyUrl=Copier l'URL
fixedServiceGroup.displayName=Groupe de service
@ -153,7 +153,7 @@ fixedServiceGroup.displayDescription=Liste les services disponibles sur un syst
mappedService.displayName=Service
mappedService.displayDescription=Interagir avec un service exposé par un conteneur
customService.displayName=Service
customService.displayDescription=Ajouter un service personnalisé au tunnel et à l'ouverture
customService.displayDescription=Ajoute un port de service à distance pour établir un tunnel vers ta machine locale
fixedService.displayName=Service
fixedService.displayDescription=Utiliser un service prédéfini
noServices=Aucun service disponible

View file

@ -143,9 +143,9 @@ serviceHostDescription=L'host su cui è in esecuzione il servizio
openWebsite=Sito web aperto
customServiceGroup.displayName=Gruppo di servizio
customServiceGroup.displayDescription=Raggruppa più servizi in un'unica categoria
initScript=Eseguire su shell init
shellScript=Rendere disponibile lo script durante la sessione di shell
fileScript=Consente di richiamare uno script con argomenti di file nel browser di file
initScript=Script di avvio - Eseguito all'avvio della shell
shellScript=Script di sessione - Rendi disponibile lo script durante la sessione della shell
fileScript=File script - Consente di richiamare uno script con argomenti di file nel browser di file
runScript=Esegui script
copyUrl=Copia URL
fixedServiceGroup.displayName=Gruppo di servizio
@ -153,7 +153,7 @@ fixedServiceGroup.displayDescription=Elenco dei servizi disponibili su un sistem
mappedService.displayName=Servizio
mappedService.displayDescription=Interagire con un servizio esposto da un contenitore
customService.displayName=Servizio
customService.displayDescription=Aggiungi un servizio personalizzato per il tunnel e l'apertura
customService.displayDescription=Aggiungi una porta di servizio remoto per creare un tunnel verso la tua macchina locale
fixedService.displayName=Servizio
fixedService.displayDescription=Utilizzare un servizio predefinito
noServices=Nessun servizio disponibile

View file

@ -143,9 +143,9 @@ serviceHostDescription=サービスが稼働しているホスト
openWebsite=オープンウェブサイト
customServiceGroup.displayName=サービスグループ
customServiceGroup.displayDescription=複数のサービスを1つのカテゴリーにまとめる
initScript=シェル init で実行する
shellScript=シェルセッション中にスクリプトを利用可能にする
fileScript=ファイルブラウザでファイル引数を指定してスクリプトを呼び出せるようにする
initScript=initスクリプト - シェルのinit時に実行する
shellScript=セッションスクリプト - シェルセッション中にスクリプトを利用可能にする
fileScript=ファイルスクリプト - ファイルブラウザでファイル引数を指定してスクリプトを呼び出せるようにする
runScript=スクリプトを実行する
copyUrl=URLをコピーする
fixedServiceGroup.displayName=サービスグループ
@ -153,7 +153,7 @@ fixedServiceGroup.displayDescription=システムで利用可能なサービス
mappedService.displayName=サービス
mappedService.displayDescription=コンテナによって公開されたサービスとやりとりする
customService.displayName=サービス
customService.displayDescription=トンネルとオープンにカスタムサービスを追加する
customService.displayDescription=リモートサービスのポートを追加し、ローカルマシンにトンネリングする
fixedService.displayName=サービス
fixedService.displayDescription=定義済みのサービスを使う
noServices=利用可能なサービスはない

View file

@ -143,9 +143,9 @@ serviceHostDescription=De host waarop de service draait
openWebsite=Open website
customServiceGroup.displayName=Servicegroep
customServiceGroup.displayDescription=Groepeer meerdere diensten in één categorie
initScript=Uitvoeren op shell init
shellScript=Script beschikbaar maken tijdens shellsessie
fileScript=Laat toe dat een script wordt aangeroepen met bestandsargumenten in de bestandsbrowser
initScript=Init script - Uitvoeren op shell init
shellScript=Sessiescript - Script beschikbaar maken tijdens een shellsessie
fileScript=Bestandsscript - Laat toe dat script wordt aangeroepen met bestandsargumenten in de bestandsbrowser
runScript=Script uitvoeren
copyUrl=URL kopiëren
fixedServiceGroup.displayName=Servicegroep
@ -153,7 +153,7 @@ fixedServiceGroup.displayDescription=Een lijst van beschikbare services op een s
mappedService.displayName=Service
mappedService.displayDescription=Interactie met een service die wordt aangeboden door een container
customService.displayName=Service
customService.displayDescription=Een aangepaste service toevoegen aan tunnel en openen
customService.displayDescription=Een servicepoort op afstand toevoegen om te tunnelen naar je lokale machine
fixedService.displayName=Service
fixedService.displayDescription=Een vooraf gedefinieerde service gebruiken
noServices=Geen beschikbare diensten

View file

@ -143,9 +143,9 @@ serviceHostDescription=O anfitrião em que o serviço está a ser executado
openWebsite=Abre o sítio Web
customServiceGroup.displayName=Grupo de serviços
customServiceGroup.displayDescription=Agrupa vários serviços numa categoria
initScript=Corre no shell init
shellScript=Torna o script disponível durante a sessão da shell
fileScript=Permite que o script seja chamado com argumentos de ficheiro no navegador de ficheiros
initScript=Script de inicialização - Executa na inicialização do shell
shellScript=Script de sessão - Torna o script disponível durante a sessão do shell
fileScript=Script de ficheiro - Permite que o script seja chamado com argumentos de ficheiro no navegador de ficheiros
runScript=Executa o script
copyUrl=Copia o URL
fixedServiceGroup.displayName=Grupo de serviços
@ -153,7 +153,7 @@ fixedServiceGroup.displayDescription=Lista os serviços disponíveis num sistema
mappedService.displayName=Serviço
mappedService.displayDescription=Interage com um serviço exposto por um contentor
customService.displayName=Serviço
customService.displayDescription=Adiciona um serviço personalizado ao túnel e abre
customService.displayDescription=Adiciona uma porta de serviço remoto para fazer um túnel para a tua máquina local
fixedService.displayName=Serviço
fixedService.displayDescription=Utiliza um serviço predefinido
noServices=Não há serviços disponíveis

View file

@ -143,9 +143,9 @@ serviceHostDescription=Хост, на котором запущена служб
openWebsite=Открытый сайт
customServiceGroup.displayName=Группа услуг
customServiceGroup.displayDescription=Сгруппируйте несколько сервисов в одну категорию
initScript=Запуск на shell init
shellScript=Сделать скрипт доступным во время сеанса оболочки
fileScript=Разрешить вызов скрипта с аргументами в виде файлов в браузере файлов
initScript=Init script - скрипт, запускаемый при инициализации оболочки
shellScript=Скрипт сессии - сделай скрипт доступным во время сеанса работы с оболочкой
fileScript=Файловый скрипт - позволяет вызывать скрипт с аргументами файла в файловом браузере
runScript=Запуск скрипта
copyUrl=Копировать URL
fixedServiceGroup.displayName=Группа услуг
@ -153,7 +153,7 @@ fixedServiceGroup.displayDescription=Список доступных серви
mappedService.displayName=Сервис
mappedService.displayDescription=Взаимодействие с сервисом, открываемым контейнером
customService.displayName=Сервис
customService.displayDescription=Добавьте пользовательский сервис для туннелирования и открытия
customService.displayDescription=Добавьте порт удаленного сервиса для туннелирования к локальной машине
fixedService.displayName=Сервис
fixedService.displayDescription=Использовать предопределенный сервис
noServices=Нет доступных сервисов

View file

@ -143,9 +143,9 @@ serviceHostDescription=Hizmetin üzerinde çalıştığı ana bilgisayar
openWebsite=ık web sitesi
customServiceGroup.displayName=Hizmet grubu
customServiceGroup.displayDescription=Birden fazla hizmeti tek bir kategoride gruplayın
initScript=Kabuk başlangıcında çalıştır
shellScript=Kabuk oturumu sırasında komut dosyasını kullanılabilir hale getirme
fileScript=Kodun dosya tarayıcısında dosya bağımsız değişkenleriyle çağrılmasına izin ver
initScript=Başlangıç betiği - Kabuk başlangıcında çalıştır
shellScript=Oturum betiği - Betiği kabuk oturumu sırasında kullanılabilir hale getirin
fileScript=Dosya betiği - Dosya tarayıcısında betiğin dosya argümanlarıyla çağrılmasına izin ver
runScript=Komut dosyasını çalıştır
copyUrl=URL'yi kopyala
fixedServiceGroup.displayName=Hizmet grubu
@ -153,7 +153,7 @@ fixedServiceGroup.displayDescription=Bir sistemdeki mevcut hizmetleri listeleme
mappedService.displayName=Hizmet
mappedService.displayDescription=Bir konteyner tarafından sunulan bir hizmetle etkileşim
customService.displayName=Hizmet
customService.displayDescription=Tünele özel bir hizmet ekleyin ve açın
customService.displayDescription=Yerel makinenize tünel açmak için bir uzak hizmet bağlantı noktası ekleyin
fixedService.displayName=Hizmet
fixedService.displayDescription=Önceden tanımlanmış bir hizmet kullanın
noServices=Mevcut hizmet yok

View file

@ -143,9 +143,9 @@ serviceHostDescription=服务运行的主机
openWebsite=打开网站
customServiceGroup.displayName=服务组
customServiceGroup.displayDescription=将多项服务归为一类
initScript=在 shell init 上运行
shellScript=在 shell 会话中提供脚本
fileScript=允许在文件浏览器中使用文件参数调用脚本
initScript=初始脚本 - 在 shell 启动时运行
shellScript=会话脚本 - 在 shell 会话期间提供脚本
fileScript=文件脚本 - 允许在文件浏览器中使用文件参数调用脚本
runScript=运行脚本
copyUrl=复制 URL
fixedServiceGroup.displayName=服务组
@ -153,7 +153,7 @@ fixedServiceGroup.displayDescription=列出系统中可用的服务
mappedService.displayName=服务
mappedService.displayDescription=与容器暴露的服务交互
customService.displayName=服务
customService.displayDescription=为隧道和开放添加自定义服务
customService.displayDescription=添加远程服务端口,以隧道方式连接本地计算机
fixedService.displayName=服务
fixedService.displayDescription=使用预定义服务
noServices=无可用服务

View file

@ -2,9 +2,9 @@
You can use a script in multiple different scenarios.
When enabling a script, the execution types dictate what XPipe will do with the script.
When enabling a script via its enable toggle button, the execution types dictate what XPipe will do with the script.
## Init scripts
## Init script type
When a script is designated as init script, it can be selected in shell environments.
@ -18,33 +18,37 @@ alias l="ls -CF"
```
you will have access to these aliases in all compatible shell sessions if the script is enabled.
## Shell scripts
## Session script type
A normal shell script is intended to be called in a shell session in your terminal.
A shell session script is intended to be called in a shell session in your terminal.
When enabled, the script will be copied to the target system and put into the PATH in all compatible shells.
This allows you to call the script from anywhere in a terminal session.
The script name will be lowercased and spaces will be replaced with underscores, allowing you to easily call the script.
For example, if you create a simple shell script named `apti` like
For example, if you create a simple shell script named `apti` with
```
sudo apt install "$1"
```
you can call that on any compatible system with `apti.sh <pkg>` if the script is enabled.
you can call the script on any compatible system with `apti.sh <pkg>` if the script is enabled.
## File scripts
## File script type
Lastly, you can also run custom script with file inputs from the file browser interface.
When a file script is enabled, it will show up in the file browser to be run with file inputs.
For example, if you create a simple file script like
```
sudo apt install "$@"
diff "$1" "$2"
```
you can run the script on selected files if the script is enabled.
In this example, the script will only run successfully if you have exactly two files selected.
Otherwise, the diff command will fail.
## Multiple types
As the sample file script is the same as the sample shell script above,
you see that you can also tick multiple boxes for execution types of a script if they should be used in multiple scenarios.
You can also tick multiple boxes for execution types of a script if they should be used in multiple scenarios.
For example in many cases, you can use file scripts also as normal shell scripts
to bring into your shell sessions to call them with specific arguments manually.