Make the :doc
command work even if lf
is not in the PATH, add lf
environment variable
#1176
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This makes
lf
export a new environment variable namedlf
with the path to thelf
binary. So, scripts can use$lf
instead oflf
and work even inlf
is not in the path.The
:doc
command now executes$lf -doc
(or%lf% -doc
on Windows) instead oflf -doc
. I'd appreciate it if somebody could double-check that this works on Windows.If Go fails to find a path to the lf binary,
$lf
is set to the stringlf
so that it still works iflf
is in the PATH. (Though, from looking at the source briefly, Go might already look in the path if it couldn't find the binary normally)Before this change,
:doc
did not work iflf
is not in the PATH. This is likely to be a problem for new users who are trying outlf
and need docs the most.Moreover, if a developer makes some changes to the docs and runs
lf
withgo run .
,:doc
would previously return the docs for the version oflf
in the PATH (if any) instead of what is expected.Another motivation for this is to make adding command-line options like
lf -buffers
(see #1152 (comment)) orlf -marks
, if we decide it's a good idea in the future, work regardless of whether lf is in the PATH.