denisidoro / navi

An interactive cheatsheet tool for the command-line
Apache License 2.0
14.61k stars 489 forks source link

[feature request] Make `navi` variables to `fzf`'s `header` option #899

Open tapyu opened 1 month ago

tapyu commented 1 month ago

Is your feature request related to a problem? Please describe. Let us consider that I want to create a navi cheat sheet to print a line of a file using sed.

% sed

# Print a specific line from a file
sed -n <number>p <file>

$ file: find . -maxdepth 1 -type f | cut -c3-
$ number: export aux=$(wc -l <file> | cut -d ' ' -f 1) --- --header "This file contains $aux pages"

Describe the solution you'd like My idea is that the aux variable becomes available to fzf so that it prints out a header like

This file contains 618 pages

Describe alternatives you've considered I tried some syntax such as <file>, $file, etc. But it seems that fzf is insensitive to any variable declared by navi.

chiva commented 17 hours ago

You can try a workaround for the same result

% sed

# Print a specific line from a file
sed -n <number>p <file>

$ file: find . -maxdepth 1 -type f | cut -c3-
$ number: aux=$(wc -l <file> | cut -f 1) && echo "This file contains $aux pages" --- --header-lines 1