Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
etersoft-build-utils
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
korinf
etersoft-build-utils
Commits
bd56ce32
You need to sign in or sign up before continuing.
Commit
bd56ce32
authored
Jul 03, 2011
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
common: introduce docmd and showcmd funcs
parent
6f40be9d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
134 additions
and
3 deletions
+134
-3
common
share/eterbuild/functions/common
+21
-3
outformat
share/eterbuild/functions/outformat
+113
-0
No files found.
share/eterbuild/functions/common
View file @
bd56ce32
...
...
@@ -11,7 +11,7 @@ realpath()
readlink
-f
"
$@
"
}
#
Выводит указанное сообщение об ошибке и завершает программу
#
Print error message and stop the program
fatal
()
{
if
[
-z
"
$TEXTDOMAIN
"
]
;
then
...
...
@@ -22,7 +22,7 @@ fatal()
exit
1
}
#
Выводит указанное сообщение
#
Just print warning message
warning
()
{
if
[
-z
"
$TEXTDOMAIN
"
]
;
then
...
...
@@ -32,6 +32,7 @@ warning()
fi
}
set_eterbuilddir
()
{
[
-z
"
$ETERBUILDDIR
"
]
||
return
0
...
...
@@ -135,7 +136,7 @@ load_mod()
done
}
load_mod config gettext alt spec strings
load_mod config gettext alt spec strings
outformat
# check for needed version
...
...
@@ -277,3 +278,20 @@ check_display()
[
-n
"
$XSET
"
]
||
return
$XSET
-b
}
# Print command line and run command line
docmd
()
{
SETCOLOR_SUCCESS
echo
"
\$
$@
"
SETCOLOR_NORMAL
$@
}
# Print command line only
showcmd
()
{
SETCOLOR_SUCCESS
echo
"
\$
$@
"
SETCOLOR_NORMAL
}
share/eterbuild/functions/outformat
0 → 100644
View file @
bd56ce32
#!/bin/sh
# Output formatting functions.
#
# Copyright (C) 2002 Ivan Zakharyaschev <imz@altlinux.ru>.
# Copyright (C) 2002 Dmitry V. Levin <ldv@altlinux.org>.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Set a sane TERM required for tput
[
-n
"
$TERM
"
]
||
TERM
=
dumb
export
TERM
# Offset from right margin of the screen to start status labels at.
:
{
RES_OFFSET:
=
8
}
[
-n
"
$RES_OFFSET
"
]
&&
[
"
$RES_OFFSET
"
-gt
0
]
2>/dev/null
||
RES_OFFSET
=
8
isatty
()
{
# see http://perl.plover.com/yak/commands-perl/samples/slide016.html
# python -c 'import os, sys; sys.exit(int(not os.isatty(1)))'
test
-t
1
}
# Use color or no
isatty
&&
TERMOUTPUT
=
1
||
TERMOUTPUT
=
# The cmd names and color codes used as arguments for tput(1)
# were taken from terminfo(5).
# Terminal sequence to move to that position.
MOVE_TO_COL
()
{
[
-n
"
$COLUMNS
"
]
||
COLUMNS
=
80
# "tput hpa N" moves to col N; on dumb terms does nothing.
local
pos
=
$((
$COLUMNS
-
$RES_OFFSET
))
[
$pos
-le
0
]
||
tput
--
hpa
$((
$COLUMNS
-
$RES_OFFSET
))
# Horizontal Position Absolute.
}
# Enumerate colors
:
${
BLACK
:
=0
}
${
RED
:
=1
}
${
GREEN
:
=2
}
${
YELLOW
:
=3
}
${
BLUE
:
=4
}
${
MAGENTA
:
=5
}
${
CYAN
:
=6
}
${
WHITE
:
=7
}
# Set 'success' color (currently: green)
SETCOLOR_SUCCESS
()
{
[
-n
"
$TERMOUTPUT
"
]
||
return
{
echo
bold
echo
setaf
$GREEN
}
|tput
-S
}
# Set 'failure' color (currently: red)
SETCOLOR_FAILURE
()
{
[
-n
"
$TERMOUTPUT
"
]
||
return
{
echo
bold
echo
setaf
$RED
}
|tput
-S
}
# Set 'warning' color (currently: yellow)
SETCOLOR_WARNING
()
{
[
-n
"
$TERMOUTPUT
"
]
||
return
{
echo
bold
echo
setaf
$YELLOW
}
|tput
-S
}
# Set 'info' color (currently: cyan)
SETCOLOR_INFO
()
{
[
-n
"
$TERMOUTPUT
"
]
||
return
{
echo
bold
echo
setaf
$CYAN
}
|tput
-S
}
# Set 'banner' color (currently: blue on yellow)
SETCOLOR_BANNER
()
{
[
-n
"
$TERMOUTPUT
"
]
||
return
{
echo
setaf
$BLUE
echo
setab
$YELLOW
}
|tput
-S
}
# Terminal sequence to reset to the default color.
SETCOLOR_NORMAL
()
{
[
-n
"
$TERMOUTPUT
"
]
||
return
{
echo
op
;
# set Original color Pair.
echo
sgr0
;
# turn off all special graphics mode (bold in our case).
}
|tput
-S
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment