> I find myself writing a lot of scripts at work lately that generate
> reports on the command line. I was thinking it might be kind of fun
> to have a "beach ball" effect on the cursor to let the user know
stuff
> is happening. For example, I remember install screens for DOS
> programs used to have the pipe character "spin" around. Is there
a
> library that handles this sort of thing?
If you have a reasonable normal shell you could do this:
spinners = [''|'', ''/'', ''-'',
''\\'']
printf "%s", spinners[0]
STDOUT.flush
1.upto(1000) do |i|
printf "\b%s", spinners[i % spinners.size]
STDOUT.flush
sleep(0.1)
end
Works on OSX''s bash anyway... I''m sure someone out there can
condense that into one line :) Replace the sleep() call with
something that takes awhile to process otherwise all you see is a blur.
-philip
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---