// Copyright (c) 2026 Storm Dragon // SPDX-License-Identifier: GPL-3.0-or-later package app import ( "strings" "git.stormux.org/storm/fenrir/internal/control" ) func shell_quote(text string) string { return "'" + strings.ReplaceAll(text, "'", "'\"'\"'") + "'" } // The last simple command receives the arguments following the alias. Keep the // optional reader request in an OR list so errexit cannot prevent the launch. func application_alias(id, socketPath string) string { program := "" switch id { case "networkmanager": program = "nmtui" case "ninjam": program = "cninjam" case "rogue", "codex": program = id default: return "" } if socketPath == "" { socketPath = control.MainSocket } body := "(echo " + shell_quote("command application "+id) + " | socat -T 2 - " + shell_quote("UNIX-CLIENT:"+socketPath) + ") || :; command " + program return "alias " + program + "=" + shell_quote(body) }