Skip to content

fzz-1.1.0 - Print it!

Latest
Compare
Choose a tag to compare
@mrnugget mrnugget released this 25 Jun 05:25
· 2 commits to master since this release

This release adds the -p option to fzz. The mnemonic here is "p" for "print".

Using this flag tells fzz to print the interactively typed input after exiting, but only if the specified command didn't return any results.

Example use case for -p: search for a file and if it doesn't exist, create it.

#!/usr/bin/env bash

filename=$(fzz -p find . -iname "*{{}}*" | head -n 1)

if [ -e  "${filename}" ]; then
  echo "File found"
else
  echo "File not found. Creating it..."
  touch "${filename}"
fi

Replace find with ag/grep and touch with $EDITOR and you're looking at your own homebuilt nvALT.