title: Fish Shell function that works with piped input or with argument based input
body: <p>I'm trying to create a fish shell function that will trim new lines from the input and then copy the input to the clipboard.</p>
  
  <p>How can I write this function so that it will;</p>
  
  <ul>
  <li>Process pipeline input (this works now)</li>
  <li>Process first argument as if it were input piped to the function</li>
  <li>Exit immediately in the case that no value is provided via argument or pipeline, right now <code>tr</code> will not exit without some value being passed in the pipeline</li>
  </ul>
  
  <p>Code:</p>
  
  <pre><code>function copy --description 'Trim new lines and copy to clipboard'
      tr -d '\n' | pbcopy
  end
  </code></pre>