noborus/ov

Feature request: allow to pass a caption via command line

ccoVeille opened this issue · 7 comments

I'm using ov as a pager for delta, git, and others

I'm facing a frustration about something.

What ever I open, STDIN is displayed at the bottom, when used as a pager of course

I looked at the code and I would like to be able to provide a Document.Caption by providing parameter.

something like ov --caption="git diff" or whatever I need or want.

I looked at the code, it looks simple to implement I could do it if you want, but I wanted to open an issue first to discuss it with you @noborus

Please note, I found a way by using optimizedMan hack

manPN := os.Getenv("MAN_PN")

so, when I play with MAN_PN environment variable, I'm somehow able to achieve what I want, but it's uneasy and tricky.

This command would provide

MAN_PN='whatever' git diff
whatever:search:•

Thank you for the problem.

I thought it would be nice to be able to specify the caption externally, but I couldn't decide how to specify it.

I will take your opinion into account.

I'm unsure if your question is about how to code it, or how a user could tell ov to use a different "caption".

by how, I can see the following well known way:

  • arguments
  • Environment variables

Based on your way your project is designed, I think using --caption would be the best, so it would appear in the --help

I mean I understand you used MAN_PN because man set it up automatically, so using it was making sense.

For me an environment variable should be consistent over the time, base on the way I help you to document how to use git delta

noborus/noborus.github.io#3

I would say it would be uneasy to pass an environment variable to external tools such as delta

So for me something equivalent to --caption should be ok.

Then if your question was about how to code it, I started a naive implementation

ccoVeille@9170448

I'm not happy about it, but it works. I would have preferred to have something in oviewer.go, because right now it's not working in exec or log mode.

Also, as there is no tests on existing code for this part, I feel like I would which make changes a bit difficult.

sorry. There's no need to be too confused.

I think specifying the caption via CLI options would probably be acceptable.
thank you.

I would say this one is closed.

Thanks for implementing it

Implemented in v0.34.0.
thank you very much.
https://github.com/noborus/ov/releases/tag/v0.34.0