Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
eepm
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
Nurlan
eepm
Commits
ad1ac3a9
Commit
ad1ac3a9
authored
Jul 21, 2012
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
epm: add quiet mode (no print commands before run), add color support for output
parent
a9c283b7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
5 deletions
+41
-5
epm
bin/epm
+4
-0
epm-sh-functions
bin/epm-sh-functions
+37
-5
No files found.
bin/epm
View file @
ad1ac3a9
...
...
@@ -56,6 +56,7 @@ Usage="Usage: epm [options] <command> [package name(s), package files]..."
Descr
=
"epm - EPM package manager"
verbose
=
quiet
=
non_interactive
=
epm_cmd
=
pkg_files
=
...
...
@@ -93,6 +94,9 @@ for opt in "$@" ; do
--verbose
)
# HELPOPT: verbose mode
verbose
=
1
;;
--quiet
)
# HELPOPT: quiet mode (do not print commands before exec)
quiet
=
1
;;
--auto
)
# HELPOPT: non interactive mode
non_interactive
=
1
;;
...
...
bin/epm-sh-functions
View file @
ad1ac3a9
...
...
@@ -18,6 +18,35 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
#
# copied from /etc/init.d/outformat (ALT Linux)
isatty
()
{
# Set a sane TERM required for tput
[
-n
"
$TERM
"
]
||
TERM
=
dumb
export
TERM
test
-t
1
}
:
${
BLACK
:
=0
}
${
RED
:
=1
}
${
GREEN
:
=2
}
${
YELLOW
:
=3
}
${
BLUE
:
=4
}
${
MAGENTA
:
=5
}
${
CYAN
:
=6
}
${
WHITE
:
=7
}
set_boldcolor
()
{
isatty
||
return
{
echo
bold
echo
setaf
$1
}
|tput
-S
}
restore_color
()
{
isatty
||
return
{
echo
op
;
# set Original color Pair.
echo
sgr0
;
# turn off all special graphics mode (bold in our case).
}
|tput
-S
}
echover
()
{
[
-n
"
$verbose
"
]
||
return
...
...
@@ -42,11 +71,13 @@ realpath()
# Print command line and run command line
docmd
()
{
#SETCOLOR_SUCCESS
local
PROMTSIG
=
"
\$
"
[
"
$UID
"
=
0
]
&&
PROMTSIG
=
"#"
echo
"
$PROMTSIG
$@
"
#SETCOLOR_NORMAL
if
[
-z
"
$quiet
"
]
;
then
set_boldcolor
$GREEN
local
PROMTSIG
=
"
\$
"
[
"
$UID
"
=
0
]
&&
PROMTSIG
=
"#"
echo
"
$PROMTSIG
$@
"
restore_color
fi
"
$@
"
}
...
...
@@ -125,3 +156,4 @@ case $DISTRNAME in
esac
PMTYPE
=
$CMD
}
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