title: Running last command with sudo in fish only works if it has no arguments?
body: <p>I'm trying to write a function that does the equivalent of <code>sudo !!</code> in Bash.  It works, but only when the last command has no arguments.</p>
  
  <p>So far the function is:</p>
  
  <pre><code>function s --description "Run last command (or specified command) using sudo"
      if test $argv
          switch $argv[1]
              case '!!'
                  command sudo (echo $history[1])
              case '*'
                  command sudo $argv
          end
      else
          command sudo fish
      end
  end
  </code></pre>
  
  <p>Testing the relevant line:</p>
  
  <pre><code>$ command sudo whoami
  root
  $ whoami
  nick
  $ command sudo (echo $history[1])
  root
  </code></pre>
  
  <p>So far so good, now lets try a command with a few args:</p>
  
  <pre><code>$ echo hi &gt;&gt; /etc/motd
  An error occurred while redirecting file '/etc/motd'
  open: Permission denied
  $ command sudo (echo $history[1])
  sudo: echo hi &gt;&gt; /etc/motd: command not found
  </code></pre>
  
  <p>Hmm, strange.</p>