Less.exe

Topics: Developer Forum
Developer
Jan 8, 2007 at 7:23 PM
What do you guys think about including less.exe with a wrapper function? IANAL, so I cant tell whether the licenses are compatible. The less.exe seems to be distributed under GNU GPL.

http://www.greenwoodsoftware.com/less/
Developer
Jan 8, 2007 at 8:02 PM
hmm.. I'm a bit less fan, but wrapping an exe doesn't feel right. How about finding a console screen library / (n)curses and writing our own? I don't feel like wrapping int 10 either though..
Developer
Jan 8, 2007 at 8:02 PM
correction: a BIG less fan.
Developer
Jan 8, 2007 at 9:49 PM
well, i tend to agree. there would be some benefits in reimplementing less in c#: it would support unicode natively (i wasnt able to get unicode characters right (only tried the win32 build, it might be possible to compile it with some conversion library). we could investigate whether there is a way to read the pipeline input on the runspace thread and manage the UI on a separate thread, so you wouldnt have to wait until all results are retrieved.

we would need to choose whether to use the $Host.UI.RawUI, or the console api. i am bit worried about the power shell way, since it might not be as performant. it might also have runspace thread affinity. in the ideal world, i would prefer to implement both.

btw, i was looking for ncurses .net port some time ago, and was not successful. if you know one, let me know. however i dont see this as a problem, the win32 console api is pretty rich for our purposes.

for the 1.1 version i would definitely vote for including the existing less.exe implementation.
Coordinator
Jan 10, 2007 at 3:13 AM
That would be very cool. The current "more" function in PowerShell leaves a lot to be desired.
Developer
Jan 12, 2007 at 10:59 AM
This discussion has been copied to Work Item 7239. You may wish to continue further discussion there.
Developer
Apr 5, 2007 at 2:57 AM
Hi folks. While I'm not familiar with less, I'm finding its use for help blocking one of my common scenarios:

Lets say I've forgotten the syntax of the for command. I'm used typing "help about_for"
and paging through it till I find what I need. Then I break out of help and type what I'm looking for, using help text still on the screen as a reference. With PSCX 1.1, when I exit the help command, the help text has dissapeared.

I trust someone else has a solution for this, and I'd sure like to hear about it.
Coordinator
Apr 7, 2007 at 3:15 AM
I like it that the help output cleans up after you quite viewing help. If there is an example of something that I want to use then I swipe it to the clipboard using the mouse. I always enable quick edit.

BTW rather than paging through searching, use the search feature (assuming you know the keyword you are looking for). Just type:

/<keyword><enter>
Jun 4, 2007 at 10:17 PM
I'm with BurtHarris on this one. How does one go about disabling Less in Help? I really dislike it and miss the very simply, very quick, and very-much-leaves-text-on-the-screen default More. It's obviously a preference thing, but for my preference, I use the scroll history often and don't want anything I'm paging to go away when I exit the pager.

Otherwise, I'm loving this project.
Jun 4, 2007 at 11:51 PM

avianwaves wrote:
I'm with BurtHarris on this one. How does one go about disabling Less in Help? I really dislike it ...

I agree. I have totally removed all the PSCX items related to help. I honestly don't know if it was becuase I simply did not understand how to use them or if there is something not working right but they just made help impossible to use.

avianwaves wrote:
Otherwise, I'm loving this project.

Also fully agree!. Great project! Thanks

Coordinator
Jun 5, 2007 at 5:27 AM
Edited Jun 5, 2007 at 5:29 AM
Comment out the last two lines of $PscxHome\Profile\PscxAliases.ps1:

# Set-PscxAlias man     Get-PagedHelp         script -Force
# Set-PscxAlias help    Get-PagedHelp         script -Force
You might think about commenting out one so that you have both facilities available. Honestly being able to search the help text using less is very handy especially when getting -full help.

Before switching over why don't you try typing "h" the next time you view a help topic using less. That will explain what all the capabilities are and how to use less. If we get any more input on this one, we may decide to create a preference variable for the next version of PSCX to control whether or not less is used to page help output. However I would default the preference to use less by default.
Jun 5, 2007 at 4:14 PM

rkeithhill wrote:
...
Before switching over why don't you try typing "h" the next time you view a help topic using less. That will explain what all the capabilities are and how to use less. If we get any more input on this one, we may decide to create a preference variable for the next version of PSCX to control whether or not less is used to page help output. However I would default the preference to use less by default.

Thanks for that! I did not even know about the "h" command and being able to get to the help for less definently explained things. Enough to the point where I am now using the standard PSCX aliases again. :)
Jun 5, 2007 at 5:22 PM
Functionally, Less is very nice. I agree. But, for me, more often than not, I'm not looking to search or do advanced scrolling or anything else it provides, I just want examples that i can scroll up to and cut n' paste. Just me. I'd prefer an on/off flag, but manually disabling it for the alias "help" and keeping it for "man" seems to be the best compromise! Then I have the best of both worlds.