Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added tput code, but it doesn't work really :-(

git-svn-id: http://shflags.googlecode.com/svn/trunk/source/1.0@83 9d7cb843-df4f-0410-8a79-4785ae5a3405
  • Loading branch information...
commit 73840eba5cdfa937d5cf4a4a86886611e190f181 1 parent 0b5fef1
kate.ward@forestent.com authored
Showing with 10 additions and 4 deletions.
  1. +6 −4 src/shflags
  2. +4 −0 src/shflags_test_public.sh
View
10 src/shflags
@@ -448,12 +448,14 @@ _flags_itemInList()
# integer: width in columns of the current screen.
_flags_screenColumns()
{
- _flags_size_=`stty size 2>/dev/null`
- if [ $? -eq ${FLAGS_TRUE} ]; then
+ if _flags_size_=`stty size 2>/dev/null`; then
+ # stty size worked :-)
_flags_cols_=`expr "${_flags_size_}" : '[0-9]* \([0-9]*\)'`
+ elif _flags_cols_=`tput cols 2>/dev/null`; then
+ # TODO(kward): this doesn't actaully work... tput is executed within a
+ # sub-shell which causes the screen width to be lost.
+ : # tput worked :-)
else
- # TODO(kward): support 'tput cols' as well, if possible. be warned that it
- # doesn't work when put inside backticks (i.e. a sub-shell).
_flags_cols_=80
fi
echo ${_flags_cols_}
View
4 src/shflags_test_public.sh
@@ -135,6 +135,10 @@ testNoHelp()
oneTimeSetUp()
{
th_oneTimeSetUp
+
+ if [ ${__FLAGS_GETOPT_VERS} -eq ${__FLAGS_GETOPT_VERS_STD} ]; then
+ th_warn 'Standard version of getopt found. Some tests will be skipped.'
+ fi
}
setUp()

0 comments on commit 73840eb

Please sign in to comment.
Something went wrong with that request. Please try again.