-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Simple shell client shipping with the tldr-pages repo #527
Comments
+:100: from me, I love the simplicity. |
If you want, feel free to add it here in Wiki. There is already one bash client. |
@igorshubovych the proposal was to include this with the repo itself, i.e. as you clone the tldr-pages/tldr repo, you'd have a simple way to query and display the existing pages. It's a different thing than installing a separate, full-fledged client. I think that's a reasonable proposal and would support its inclusion. |
Oh, but then I doubt we should do it. We have some Windows users at the moment, and it will not work for them. They seems like are ok with NodeJS at the moment (seems like Rust client will beat it soon). If we consider using Bash, i would rather use this one, as it has more features: |
Yeah but that's a full-fledged client and wouldn't make sense to be included in this repo, contrary to a 11 SLOC bash script. The point about Windows is a good one, though. @sitaramc what would you suggest? |
what's the difference between 11 SLOC and 250 SLOC? Are you trying to save some bytes? |
Additionally NodeJS client can be added with 1 line in package.json |
It's subjective, sure, but I don't see the bash script as an actual client, so the separation of implementation (the client repos) and content (tldr-pages) would largely remain in place. It would just be a helper script for convenience instead of |
On 29/01/16 23:36, Waldir Pimenta wrote:
That is precisely what I meant it as. I'd also like to (re-)say something I say in the code: this is markdown. The whole point of markdown was that it should be readable as-is. I see my simple bash script as saying "here's the base model of your new car; you can fit alloy wheels and colored text by installing other clients". (did I just go all /. on this by using a car analogy? Shame on me!) |
re: "The point about Windows is a good one, though. @sitaramc what would you suggest?" I'm sorry I don't have an answer. My script is merely a POC of sorts -- it even hardcodes Linux, so not just Windows is left out in the cold, even other Unixes are. And though I could fix it for other Unixes, I have no clue about Windows. The idea is to have something that works off a local clone of the tldr repo so that every query does not go online (my frugal mind rails at that!) And don't miss how it takes just one line of code to say "update this clone in the background, but at most once a day". The other bash client is a proper bash client, colors and all. I have no intention of competing with that (though if you are going to cache stuff anyway, why not just use a local clone? I am sure 'git fetch' is a lot more efficient, especially if you're going to tldr many different commands). |
I would say it's justifiable to have a Unix-only client, especially since usually people who use command-line git on Windows typically do have a terminal emulator that supports the usual Unix stuff. So if you could get this to work on most Unixes, I'd vote for including the script. |
I still don't really like the idea of delivering even the most lightweight of clients with the repository. It would only be used by contributors and I prefer opening in an editor anyway. |
On 30/01/16 15:48, Ruben Vereecken wrote:
Frankly, I'm more concerned that all the clients seem to be downloading I realise that's subjective but I am also sure I'm not the only one who Which means "only be used by contributors" would not be accurate. |
That means someone would have to download the tldr repo and somehow put the script in PATH manually, more than is comfortable for most. Clients are there to make it easy. We have tonnes of clients but I've used only a few. Only a few we "officially support". The good ones implement the caching behavior because it's the sane way to go about it. |
At least NodeJS, Crystal and Rust clients download zip file with all pages and put it into your ~/.tldr folder. |
tldroid also follows the same approach to cache zip file locally. |
On 30/01/16 17:22, Igor Shubovych wrote:
good to know; I was clearly wrong (and I certainly did not check all This isn't anywhere near as efficient as a git fetch for updates, but |
Caching or fetching aside, it's still true that one would need to git clone this repo and install a client separately to use the pages conveniently. As this isn't an actual client (nor it aims to be), we could mention how to add the script to a path, but honestly just being able to do |
Everyone who has Adding things is easy, removing them is harder. |
|
I actually come up with a better version of this script: tldrfind () {
find pages -name "$@.md" -exec cat {} \;
} Linux is not hardcoded here. |
On 31/01/16 00:54, Igor Shubovych wrote:
But it's your baby; I'm done arguing about this. What I have here works |
@igorshubovych as I said, if @sitaramc implements support for other Unixes, I'd be in favor of merging, so point 2 is moot. To the fact that it isn't supported in Windows, I've already responded to that ("usually people who use command-line git on Windows typically do have a terminal emulator that supports the usual Unix stuff"). Do you disagree with that? Even if you do, would we really want to deny Unix users a useful tool just because Windows users can't have it? Could we think of having an equivalent .bat script for them? Finally, the color stuff it completely out of question IMO -- if we're printing markdown, the token marks already mark the placeholders clearly. And I repeat: this is not meant to be a full-featured client, just a shortcut to view the pages of the repo after cloning it locally. |
Hmm...while I see how @waldyrious has some good points, so has @igorshubovych and @rubenvereecken. My counterproposal to both sides is to add a script in the {
// some other stuff that we already have
"scripts": {
"show": "find pages -name \"$@.md\" -exec cat {} \;"
}
// even more stuffs of kinds!
} Very simple one-liner that can be easily used, comes with the repo, requiring no extra setup, and does exactly just that: show a page. But then again, if I'm editing a page in markdown...don't I already see the full page? Perhaps we don't really need this at all. |
@sitaramc I tested this in OS X and it didn't work:
Any ideas how to address this? Unfortunately I'm afraid I can't help here, as I just recently started using OS X in a work computer. By the way, I would probably suggest the git update to be dropped, or at least check if the repository is clean, on the master branch, before fetching an update. |
@Ostera, to make a point already mentioned on gitter (but just so it stays on record here), note that the variants with |
On 02/02/16 04:44, Waldir Pimenta wrote:
As I suspected (and stated in the note there), the "realpath" command Sorry, I have as much access to (and knowledge of) Mac as I do of Even if it were "readlink -f" we could have kept the script from having
In any case, if you are dropping the git update this whole thing is moot Checking if the repo is clean is easy, but that's where we come to a regards |
I don't have a Mac to test with, but since python should be pre-installed on OS X, it may have a chance to work under OS X. |
We discussed this script internally on Gitter. I will give you my points about it. I think relying on Git is not for everybody. It is very inconvenient for contributors. There are several situations, where
|
This is stale and probably should be closed. Even though tldr is a knowledge base for shell commands, Shell-format scripting isn't universal to all systems. node, C, go and python clients, among many others, let alone the growing number of web-based clients, already do this job. |
Oh, interesting issue! I wasn't aware of this one. I think we have quite a few different clients to choose from now, so there should be something for everyone. I vote to close this too, but we should wait for the opinions from others before doing so. |
I agree with you guys and vote to close this one |
Ok, that's 3 votes to close, so I'm going to close this issue. Of course, I'm happy to reopen this if this is a mistake. |
It would be nice to have a very simple shell client (nothing fancy; just 'less' the md file if found, else print a list of pages that start with the argument supplied).
At present I use https://gist.github.com/sitaramc/142c9e3d730583b9271c
And though I hesitate to offer that in a pull request, if someone thinks it looks decent or requires only minor changes to be decent I can do that.
The text was updated successfully, but these errors were encountered: