mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-18 21:40:29 +00:00
elvish: improve the sudoedit detection code (#10587)
The previous logic didn't detect the `e` option when it was combined with other flags (e.g. `-ie`). This change also attempts to improve the general readability of this code to be a bit more explicit.
This commit is contained in:
@@ -50,16 +50,19 @@
|
||||
fn sudo-with-terminfo {|@args|
|
||||
var sudoedit = $false
|
||||
for arg $args {
|
||||
use str
|
||||
if (str:has-prefix $arg -) {
|
||||
if (has-value [e -edit] $arg[1..]) {
|
||||
if (str:has-prefix $arg --) {
|
||||
if (eq $arg --edit) {
|
||||
set sudoedit = $true
|
||||
break
|
||||
}
|
||||
continue
|
||||
} elif (str:has-prefix $arg -) {
|
||||
if (str:contains (str:trim-prefix $arg -) e) {
|
||||
set sudoedit = $true
|
||||
break
|
||||
}
|
||||
} elif (not (str:contains $arg =)) {
|
||||
break
|
||||
}
|
||||
|
||||
if (not (has-value $arg =)) { break }
|
||||
}
|
||||
|
||||
if (not $sudoedit) { set args = [ --preserve-env=TERMINFO $@args ] }
|
||||
|
||||
Reference in New Issue
Block a user