Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fallback to regular man if page not exists #46

Closed
Warry opened this issue Jan 28, 2014 · 12 comments
Closed

Fallback to regular man if page not exists #46

Warry opened this issue Jan 28, 2014 · 12 comments
Labels
decision A (possibly breaking) decision regarding tldr-pages content, structure, infrastructure, etc. invalid Issues or PRs invalid for this project.

Comments

@Warry
Copy link

Warry commented Jan 28, 2014

Just in case

@nelsonpecora
Copy link

Maybe a short message saying "Sorry, no tldr page yet. Create one at [url]!" then a 2 second pause before loading the man page?

@rprieto
Copy link
Contributor

rprieto commented Feb 26, 2014

I'm not sure about the auto-opening, especially since man pages go full-screen.
Maybe a prompt like this?

No TLDR page for "ssh" yet.
Please consider contributing to the project.

- Press [o] to browse to http://github.com/rprieto/tldr
- Press [m] to open the man page instead
- Press any other key to exit

Although that's a change from the usual tldr behaviour which is to print something and exit.

@nelsonpecora
Copy link

Ooh, I really like @rprieto's idea. Would [o] just do something like open http://github.com/rprieto/tldr? (I know that opens the default browser on OSX, but not sure about other *nix).

@rprieto
Copy link
Contributor

rprieto commented Mar 6, 2014

That's what I had in mind, let's find the other *nix equivalents!

@nelsonpecora
Copy link

Hmm. Looks like there really aren't any other *nix equivalents, but you could check if chrome / firefox is installed and call them.

@waldyrious
Copy link
Member

Some pointers here, but indeed it seems there's no universal solution.

@rprieto
Copy link
Contributor

rprieto commented Aug 7, 2014

I don't have a Linux machine handy to try it, but ghwd uses:

# mac and linux-compatible open
open=open
command -v xdg-open && open=xdg-open
$open $url

@waldyrious
Copy link
Member

That's what is pointed out in the SO post I linked to. A comment there says it doesn't work on RHEL, but I suppose apart from that its support base is probably wide enough for a start. Besides, if someone can eventually contribute something better, there are always issues and pull requests :)

@rprieto
Copy link
Contributor

rprieto commented Aug 8, 2014

Sorry, I was on the train and hadn't read your link yet 😬
You're right this should be a good start!

@rprieto
Copy link
Contributor

rprieto commented Oct 2, 2014

Just moving this issue over to tldr-node-client #9.
Each client can probably do it their own say, but I'll start work over there :)

@rprieto rprieto closed this as completed Oct 2, 2014
@ChrisCummins
Copy link

I know this thread is long dead, but incase anyone stumbles on this while Googling a solution, I use a help function defined in my .bashrc to set man as a fallback:

help() {
    tldr "$@" 2>/dev/null || { echo "No tldr entry for $1 (try tldr --update)"; man "$@" }
}

If you dont like that man is fullpage, use a different pager than the default (less). E.g. to print only the first 50 lines of the manpage:

help() {
    tldr "$@" 2>/dev/null || { echo "No tldr entry for $1 (try tldr --update)"; MANPAGER="head -n50" man "$@" }
}

@waldyrious
Copy link
Member

Nice trick, thanks for sharing @ChrisCummins! By the way, do you think you could have any input in #527? We got a little blocked trying to come up with some generic shell scripting to implement that idea.

@CleanMachine1 CleanMachine1 added decision A (possibly breaking) decision regarding tldr-pages content, structure, infrastructure, etc. invalid Issues or PRs invalid for this project. labels Jul 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
decision A (possibly breaking) decision regarding tldr-pages content, structure, infrastructure, etc. invalid Issues or PRs invalid for this project.
Projects
None yet
Development

No branches or pull requests

6 participants