mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-27 03:13:37 +08:00
9367d4ff71
This does not include checks/function.fish because that currently includes a "; end" in a message that indent would remove, breaking the test.
10 lines
307 B
Fish
10 lines
307 B
Fish
function __fish_prepend_sudo -d "Prepend 'sudo ' to the beginning of the current commandline"
|
|
set -l cmd (commandline -poc)
|
|
if test "$cmd[1]" != sudo
|
|
set -l cursor (commandline -C)
|
|
commandline -C 0
|
|
commandline -i "sudo "
|
|
commandline -C (math $cursor + 5)
|
|
end
|
|
end
|