From feb87bbda82c79d93a96b4c741afc07b080a1101 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Thu, 19 Dec 2019 23:41:26 +0100 Subject: [PATCH] __fish_man_page: ignore prefixing variable assignments --- share/functions/__fish_man_page.fish | 4 ++-- share/functions/__fish_prepend_sudo.fish | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/share/functions/__fish_man_page.fish b/share/functions/__fish_man_page.fish index 38979eeee..192b92077 100644 --- a/share/functions/__fish_man_page.fish +++ b/share/functions/__fish_man_page.fish @@ -10,8 +10,8 @@ function __fish_man_page #Skip `sudo` and display then manpage of following command while set -q args[2] - and test $args[1] = "sudo" - set args $args[2..-1] + and string match -qr -- '^(sudo|.*=.*)$' $args[1] + set -e args[1] end # If there are at least two tokens not starting with "-", the second one might be a subcommand. diff --git a/share/functions/__fish_prepend_sudo.fish b/share/functions/__fish_prepend_sudo.fish index a696d8ac3..aaca6c37a 100644 --- a/share/functions/__fish_prepend_sudo.fish +++ b/share/functions/__fish_prepend_sudo.fish @@ -1,5 +1,5 @@ function __fish_prepend_sudo -d "Prepend 'sudo ' to the beginning of the current commandline" - set -l cmd (commandline -boc) + set -l cmd (commandline -poc) if test "$cmd[1]" != "sudo" commandline -C 0 commandline -i "sudo "