Created
January 11, 2016 17:10
-
-
Save anonymous/8b6495910a037a27ab84 to your computer and use it in GitHub Desktop.
pipe something to ruby and print terminal-width
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/ruby | |
require 'pp' # equivalent to data::dumper | |
# require 'terminfo' | |
# TermInfo.control("cuf", 7) # cursor forward 7 columns | |
# p TermInfo.screen_size # use TIOCGWINSZ, LINES/COLUMNS env. or terminfo lines#/cols# | |
# puts STDIN.winsize | |
require 'readline'; | |
puts Readline.get_screen_size | |
puts ENV['COLUMNS'] | |
require 'io/console'; | |
puts STDIN.winsize | |
require 'curses'; | |
puts Curses.cols |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment