Skip to content

Commit c0f0089

Browse files
wolfboyspan3793
authored andcommitted
[KYUUBI #2743] colorfully kyuubi logo support
We can make the logo printed by Kyuubi on the terminal colorful and vibrant. ### Why are the changes needed? - When TTY is available, print the colorfully logo, else print default ### _How was this patch tested?_ - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible - [ ] Add screenshots for manual tests if appropriate - [ ] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request Closes #2744 from wolfboys/master. Closes #2743 2205e79 [benjobs] [KYUUBI #2743] colorfully kyuubi logo support Authored-by: benjobs <benjobs@qq.com> Signed-off-by: Cheng Pan <chengpan@apache.org>
1 parent a8943bc commit c0f0089

File tree

2 files changed

+57
-10
lines changed

2 files changed

+57
-10
lines changed

bin/kyuubi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ if [[ "$@" = *--help ]] || [[ "$@" = *-h ]]; then
3636
fi
3737

3838
function kyuubi_logo() {
39-
cat ${KYUUBI_HOME}/bin/kyuubi-logo | grep -v "^#"
39+
source ${KYUUBI_HOME}/bin/kyuubi-logo
4040
}
4141

4242
function kyuubi_rotate_log() {

bin/kyuubi-logo

100644100755
Lines changed: 56 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#!/usr/bin/env bash
12
#
23
# Licensed to the Apache Software Foundation (ASF) under one or more
34
# contributor license agreements. See the NOTICE file distributed with
@@ -14,12 +15,58 @@
1415
# See the License for the specific language governing permissions and
1516
# limitations under the License.
1617
#
17-
__ __ __
18-
/\ \/\ \ /\ \ __
19-
\ \ \/'/' __ __ __ __ __ __\ \ \____/\_\
20-
\ \ , < /\ \/\ \/\ \/\ \/\ \/\ \\ \ '__`\/\ \
21-
\ \ \\`\\ \ \_\ \ \ \_\ \ \ \_\ \\ \ \L\ \ \ \
22-
\ \_\ \_\/`____ \ \____/\ \____/ \ \_,__/\ \_\
23-
\/_/\/_/`/___/> \/___/ \/___/ \/___/ \/_/
24-
/\___/
25-
\/__/
18+
19+
# Bugzilla 37848: When no TTY is available, don't output to console
20+
have_tty=0
21+
# shellcheck disable=SC2006
22+
if [[ "`tty`" != "not a tty" ]]; then
23+
have_tty=1
24+
fi
25+
26+
# Bugzilla 37848: When no TTY is available, don't output to console
27+
have_tty=0
28+
# shellcheck disable=SC2006
29+
if [[ "`tty`" != "not a tty" ]]; then
30+
have_tty=1
31+
fi
32+
33+
# Only use colors if connected to a terminal
34+
if [[ ${have_tty} -eq 1 ]]; then
35+
RAINBOW="
36+
$(printf '\033[38;5;202m')
37+
$(printf '\033[38;5;226m')
38+
$(printf '\033[38;5;082m')
39+
$(printf '\033[38;5;082m')
40+
$(printf '\033[38;5;163m')
41+
$(printf '\033[38;5;093m')
42+
"
43+
GREEN=$(printf '\033[32m')
44+
YELLOW=$(printf '\033[33m')
45+
BLUE=$(printf '\033[34m')
46+
BLUE=$(printf '\033[34m')
47+
RESET=$(printf '\033[0m')
48+
else
49+
RAINBOW=""
50+
GREEN=""
51+
YELLOW=""
52+
BLUE=""
53+
BLUE=""
54+
RESET=""
55+
fi
56+
57+
print_logo() {
58+
printf '\n\n'
59+
printf '%s __ __%s %s %s %s __ %s %s\n' $RAINBOW $RESET
60+
printf '%s /` \/` \%s %s %s %s /` \ %s __ %s\n' $RAINBOW $RESET
61+
printf '%s \ \ \/ /%s __ __%s __ __%s __ __%s\ \ \____%s /\_\ %s\n' $RAINBOW $RESET
62+
printf '%s \ \ , < %s /` \/` \%s/` \/` \%s/` \/` \%s\ \ \__` %s\/` \ %s\n' $RAINBOW $RESET
63+
printf '%s \ \ \ \`\%s\ \ \_\ \%s\ \_\ \%s\ \_\ \%s\ \ \L\ %s\ \ \ %s\n' $RAINBOW $RESET
64+
printf '%s \ \_\ \_%s \/`____ \%s \____/ %s\ \____`%s\ \_,__/ %s\ \_\ %s\n' $RAINBOW $RESET
65+
printf '%s \/_/\/_/%s `/___/> \%s/___/ %s\/___/ %s\/___/ %s\/_/ %s\n' $RAINBOW $RESET
66+
printf '%s %s /\___/ %s %s %s %s %s\n' $RAINBOW $RESET
67+
printf '%s %s \/__\/ %s %s %s %s %s\n' $RAINBOW $RESET
68+
printf '\n\n'
69+
}
70+
71+
print_logo
72+

0 commit comments

Comments
 (0)