Using fzf to Find, Preview, Then Open Files on the cli

fzf --preview "less {}" | xargs code

The above line does the following:

  1. launches fzf in the current directory with a preview on the right that uses the less editor
  2. Once you select a file it outputs the path of the file
  3. We pipe this output and use it as an argument to the code command which then opens the file in vscode

I'm not quite sure how I'll place this within the cli tool. My main questions are:

  1. FZF is installed using a sudo apt-get command. How do I ensure that everyone installing my npm package has FZF installed? This goes for any other tool that's not npm related.
  2. On a side note - how do I also add in npm related packages as part of this?
  3. Can't remember any more questions, I should have written them out before taking a break. But I'll probably run into them again then write them down