You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# default navi to print, not to execute
navi() {
if command navi --print "$@" > /tmp/navi_output; then
/usr/bin/glow /tmp/navi_output
else
echo "navi command failed" >&2
return 1
fi
}
_run_last_navi_or_builtin() {
if [ $# -gt 0 ]; then
# Use the built-in . (source) command if arguments are provided
builtin . "$@"
elif [ ! -s /tmp/navi_output ]; then
echo "No navi output found or file is empty. Run 'navi' command first." >&2
return 1
else
# Execute commands from navi output if no arguments
if ! /usr/bin/grep -q '^\$ ' /tmp/navi_output; then
echo "No executable commands found in navi output." >&2
return 1
fi
/usr/bin/grep '^\$ ' /tmp/navi_output | while read -r line; do
cmd="${line#\$ }"
echo "Executing: $cmd"
eval "$cmd"
done
fi
}
alias .="_run_last_navi_or_builtin"
With this you can use navi to search for a comand , and if you want to run it just hit .
The text was updated successfully, but these errors were encountered:
Thanks for opening your first issue here! In case you're facing a bug, please update navi to the latest version first. Maybe the bug is already solved! :)
Use this alias:
With this you can use
navi
to search for a comand , and if you want to run it just hit.
The text was updated successfully, but these errors were encountered: