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
etersoft
eepm
Commits
3e7a1c73
Commit
3e7a1c73
authored
Apr 17, 2023
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
epm play: add print out for all epm commands
parent
2ff5bd0a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
135 additions
and
0 deletions
+135
-0
common-outformat.sh
play.d/common-outformat.sh
+121
-0
common.sh
play.d/common.sh
+14
-0
No files found.
play.d/common-outformat.sh
0 → 100755
View file @
3e7a1c73
#!/bin/sh
# copied from /etc/init.d/outformat (ALT Linux)
# FIXME on Android: FIX ME! implement ttyname_r() bionic/libc/bionic/stubs.c:366
inputisatty
()
{
# check stdin
#tty -s 2>/dev/null
test
-t
0
}
isatty
()
{
# check stdout
test
-t
1
}
isatty2
()
{
# check stderr
test
-t
2
}
check_tty
()
{
isatty2
||
return
# Set a sane TERM required for tput
[
-n
"
$TERM
"
]
||
TERM
=
dumb
export
TERM
# grep -E from busybox may not --color
# grep -E from MacOS print help to stderr
if
grep
-E
--help
2>&1 |
grep
-q
--
"--color"
;
then
export
EGREPCOLOR
=
"--color"
fi
is_command tput
||
return
# FreeBSD does not support tput -S
echo
|
a
=
tput
-S
>
/dev/null 2>/dev/null
||
return
USETTY
=
"tput -S"
}
:
${
BLACK
:
=0
}
${
RED
:
=1
}
${
GREEN
:
=2
}
${
YELLOW
:
=3
}
${
BLUE
:
=4
}
${
MAGENTA
:
=5
}
${
CYAN
:
=6
}
${
WHITE
:
=7
}
set_boldcolor
()
{
[
-n
"
$USETTY
"
]
||
return
{
echo
bold
echo
setaf
$1
}
|
$USETTY
}
set_color
()
{
[
-n
"
$USETTY
"
]
||
return
{
echo
setaf
$1
}
|
$USETTY
}
restore_color
()
{
[
-n
"
$USETTY
"
]
||
return
{
echo
op
;
# set Original color Pair.
echo
sgr0
;
# turn off all special graphics mode (bold in our case).
}
|
$USETTY
}
echover
()
{
[
-z
"
$verbose
"
]
&&
return
echo
"
$*
"
>
&2
}
# echo string without EOL
echon
()
{
# default /bin/sh on MacOS does not recognize -n
echo
-n
"
$*
"
2>/dev/null
||
a
=
/bin/echo
-n
"
$*
"
}
is_root
()
{
local
EFFUID
=
"
$(
id
-u
)
"
[
"
$EFFUID
"
=
"0"
]
}
# Print command line and run command line
showcmd
()
{
if
[
-z
"
$quiet
"
]
;
then
set_boldcolor
$GREEN
local
PROMTSIG
=
"
\$
"
is_root
&&
PROMTSIG
=
"#"
echo
"
$PROMTSIG
$*
"
restore_color
fi
>
&2
}
# Print command
echocmd
()
{
set_boldcolor
$GREEN
local
PROMTSIG
=
"
\$
"
is_root
&&
PROMTSIG
=
"#"
echo
-n
"
$PROMTSIG
$*
"
restore_color
}
# Print command line and run command line
docmd
()
{
showcmd
"
$*$EXTRA_SHOWDOCMD
"
"
$@
"
}
play.d/common.sh
View file @
3e7a1c73
...
...
@@ -143,3 +143,17 @@ if [ -z "$SUDO" ] && [ "$UID" != "0" ] ; then
fi
is_supported_arch
"
$(
epm print info
-a
)
"
||
fatal
"Only '
$SUPPORTEDARCHES
' architectures is supported"
.
$(
dirname
$0
)
/common-outformat.sh
check_tty
# add to all epm calls
EPM
=
"
$(
epm tool which epm
)
"
||
fatal
epm
()
{
if
[
"
$1
"
!=
"print"
]
;
then
showcmd
"
$(
basename
$EPM
)
$*
"
fi
$EPM
"
$@
"
}
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