Closed IanTrudel closed 7 years ago
Did you mean your irb at alt-=. ? Assuming so, Shoes.show_console
brings up the new shoes.terminal which on cshoes.exe you might not notice unless you look very hard. . If you want the older Shoes log window with it's alternating colored bands then use Shoes.show_log
, I think is documented somewhere but you might have been off-line at the tme or not realized what it meant to your irb code. It should be re-written to use the new shoes.terminal but then it loses all the gui you built. You can readline from the shoes.terminal which is what real irb and byebug use.
In Ruby 2.4 (should Shoes ever get there), one can invoke irb from inside a script and it won't be using your simulated alt-= window
For additional documented at github fun, irb and byebug fight to redefine ruby's at_exit. (quit) so you can't use both in Shoes.
Yes, this is the terminal window. I'm trying the feature. The close button close the terminal but also Shoes. It should just close the terminal window.
The Shoes Console and Shoes IRB are obviously different. Not sure why you'd want to get rid of them in the future. From what you're saying, we should be able to come up with something built in Shoes. I had a prototype Shoes app that used the real IRB but IRB uses readline which didn't like Windows and non-stdout/stdin.
I think my logic with the terminal close is/was -- Shoes has no control of that window and vice versa except for escape sequences on stdout. Because it replaces stdin/stdout/stderr for the process there can be only one. In the case of Windows, it's Windows thats is killing the process. I don't think I can fix that - I did look for alternative terminals on Windows but didn't find anything open source and maintainable - just ugly ways to hack the MSFT console.
I don't use Shoes IRB myslef because I always have two or three terminals open if I need to check some ruby one liners. My typing is not good enough to use IRB for anything more. I also don't like black backgrounds but since I don't use it, it's not that important to me.
You might be able to do something if the console has its own process. Maybe take a look at Running both console and GUI on stackoverflow.
As far as I am concerned, I do use Shoes IRB and Shoes Console. Terminal doesn't seem to do anything on Windows, not sure how to use it either. How to use it? You came up with cshoes a few releases ago and this is actually useful from Windows cmd (though Shoes Console would be just as fine).
Maybe it's not a Windows friendly feature. Maybe I don't get Shoes Terminal. Regardless, it feels kinda wrong to close Shoes when the terminal is closed.
Package up your app that uses Shoes.terminal and run it from the Window start menu instead. Or use shoes.exe to launch it - all different from cshoes.exe. Useful to some? Maybe. Useful to all? No. It's for people to want the stdout.puts in their old ruby scripts or gems (or tests) to appear somewhere when run from a GUI. The only way you discovered the missing hicolor-theme bug was because you used cshoes.exe - shoes.exe and packaged apps didn't get that error message.
How to use it?
Not current but a background
In Tests/test_color we use Shoes.terminal
There is nothing friendly in Windows to FOSS *nix apps. Just degrees of tolerance and hoops to jump over. OSX is starting be less friendly too.
it feels kinda wrong to close Shoes when the terminal is closed
It is wrong. No doubt. You could ask MSFT to fix it in Windows 12. I have to be pragmatic and work with how things are now.
How to use it?
Did you look in manual?
It's for people to want the stdout.puts in their old ruby scripts or gems (or tests) to appear somewhere when run from a GUI. The only way you discovered the missing hicolor-theme bug was because you used cshoes.exe - shoes.exe and packaged apps didn't get that error message.
Wouldn't cshoes be enough?
Did you look in manual?
I did. There is a bunch of text that warns of the dangers of Shoes.terminal but no examples. The wiki page Shoes terminal makes it much more clear how to use it. I recommend to add code examples that can use run this feature, such as the one on your wiki page. Please, take note that STDOUT needs flushing to display output whet puts or print is called.
# Configure STDOUT to flush output immediately
STDOUT.sync = true
Shoes.terminal
STDOUT.puts "Hello from Shoes!"
# STDIN/STDOUT are also $stdin/$stdout
$stdout.puts "Anything else? "
msg = $stdin.gets
STDOUT.puts msg
STDIN.gets
it feels kinda wrong to close Shoes when the terminal is closed
It is wrong. No doubt. You could ask MSFT to fix it in Windows 12. I have to be pragmatic and work with how things are now.
Sure, but it doesn't seem to do anything more than cshoes does. It might make sense for OS X or something else. I obviously don't get Shoes Terminal. Even checked the issues #17, #110 and #124 as suggested on the wiki. All of those are working with cshoes. o_O
Shoes.terminal is for C style strings. Add a \n if you want a flush. Sometimes you don't.
It really could matter for OSX. or packaged apps not run from the command line. I went looking for a Ruby implementation of the old text/terminal game Adventure (Zork is descendant). I found half implemented student projects and no data files for a real game(s). Assume you have the game engine in Ruby and some games (data files) and it just uses puts and readline to communicate. You could write a little Shoes front end with a drop down list of games available and a 'run' button (and quit button), pop up the Shoes.terminal and start the game. You could package it up as a Shoes.app and that end user wouldn't need to start anything from the command line need instructions to start the dos console and type 'this-to-start-game' or tell them how to find Terminal.app in /Applications/Utilities
Perhaps you think "Why not rewrite the game engine in Shoes and use a edit_block for output and an edit_line for input? Now that we have edit_block.append() that wouldn't suck too much. It loses the spirit of the old game though. Using Shoes.terminal however you get better scrolling and window size/placement, and the copy/clear button for free. Of course you'd need the game engine and that doesn't seem to exist in ruby. Fun project for someone.
Or use a front end written in Shoes and invoke Ruby to run Adventure.
o_O
Assumes ruby is installed and we can find it. Also assumes the terminal is creates. Only Windows does that. FYI, I did find a Python port of the original game which does look like a difficult conversion to Ruby. Something for a rainy day, I suppose.
Shoes just ain't the tool for console apps. The whole thing is not making any sense to me but it's probably your pet project. I should leave it at that. :D
Open a terminal using IRB (alt-/), type
Shoes.show_console
, and then (only) close the terminal. The whole Shoes quits. Take note that the manual says to typeShoes::show_console
. Both are working butShoes.show_console
should be the preferred method (manual needs update).