-
Notifications
You must be signed in to change notification settings - Fork 36
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
ceylon help should page output #1506
Comments
I agree it would be nice if we could page the output. The thing is that the current Is it really worth the extra code maintainance and testing, when people can always write
or whatever? |
We could look at how git does it, perhaps just a little script-fu is enough to make this work? |
It has always pained me too that we don't support it OOTB. |
Sure it's worth looking in to. I'd prefer paged output too. AFAICS we'd need the |
And our help detection is already wrong because it's hard to detect correctly |
@quintesse what help detection is this? |
@tombentley right now the detection when the user wants help to be displayed is too simple, it can't handle "--help" being passed to sub tools for example (think |
I checked how git does this, and it's actually (as one might expect) very flexible. The help pages are available in man, info and html format and they can be displayed using different programs. The format and the program to use can be set in the configuration file. On my machine (linux) the default is to run man and on windows the default seems to be display html in the default browser. I don't think this is the right moment to spend a lot of time on creating the perfect help solution, but at the same time, as a user, I like to get nice help with a minimum of fuzz on my side. How about something like the following:
The only change that affects the system then is the option; the first two points is just a bit of script work. And as a user I only need to set my help-tool config once. I can live with that. |
Moving to 1.2 |
HAHA! It's not done in a shell script. It's done in C by spawning a pager program and piping stdout to it. We can do the same in Java by setting |
I'm not sure I understand, so who would do the paging? |
|
Ah ok, so you start the pager from within the program and then pipe the output to it. Sounds easy enough. And like they do in the git helper, look at |
Others remain broken but not sure exactly why
Works great on Linux, but on Windows it doesn't show anything at all (unless I add the |
Works fine on Linux but doesn't work on Windows, neither in Git Bash (which simulates a unix-like environment) nor in the standard Windows command line. First because |
Damn, sorry about the missing push of |
So, I tried to figure out what git does on Windows but it's not clear. Apparelty on Windows they have two strategies: one for using |
Wow, reading back C files I can say I'm glad I didn't write C code in the last seven years, that stuff is nuts. |
No, to me that sounds that they only take into account unix-like environments like MinGW. Better yet, I just tested Git on Windows and it doesn't do paging at all... it... spawns an HTML page in a browser! |
Of course, my Windows drive is dead so I can't test any of this shit anymore :( |
Well, no idea then. I haven't found the code that does this in git. |
Well we do generate HTML docs for the distribution so we could go Git's way and spawn a browser and just forget about paging on Windows. |
And using |
Btw, Git only seems to do this for some commands though. |
Also, on Windows the |
I just don't see it. Apparently they have different code paths for Windows and for Cygwin, but both would call |
I don't find anything about piping to the browser in the code for git, so I don't know how they do it. I'm tempted to just disable paging by default on Windows. Also I can't test because my Windows drive is dead. |
They don't pipe (I don't even think that's possible with browsers), they just start the browser pointing to the local HTML doc page : |
OK but I don't even know how to start a browser. |
You can just "execute" the link and Windows will open the default browser for you. But the thing is how to get the URL? |
Seriously? Just execute a link? |
Yes, although maybe better to use |
I pushed a fix for Windows, can you try it please? |
On Windows now fall back to the console if no doc files were found (ceylon/ceylon-compiler#1506)
Fixed NPE and added a fall-back to the console if the docs weren't found. Works perfectly now! |
OK, so we can close this? |
Yup |
Thanks |
When running ceylon help the output is sparsely formatted (indented, but no attributes) and not paged. I suggest to use man(1) to display the output formatted & paged, or alternatively, pipe the formatted output through $PAGER.
The text was updated successfully, but these errors were encountered: