Skip to content

Commit 8b8ae78

Browse files
committed
WIP
1 parent be19810 commit 8b8ae78

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

etc/profile.d/cli.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ if [ `id -u` -ne 0 ]; then
6161
# Valgrind
6262
export VALGRIND_OPTS="--memcheck:leak-check=full --memcheck:show-leak-kinds=all --memcheck:track-origins=yes"
6363

64-
## TODO: Start help50 if enabled
64+
# Start help50 if enabled
6565
if help50 is-enabled > /dev/null; then
6666
help50 start
6767
fi

etc/profile.d/help50.sh

+7-2
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,15 @@ function _help50() {
9292
elif [[ $status -ne 0 ]]; then # If helpless
9393
_helpless "$typescript"
9494
fi
95+
else
96+
_helped
9597
fi
9698

9799
# Truncate typescript
98100
truncate -s 0 $HELP50
99101
}
100102

101-
function _question() {
103+
function _rhetorical() {
102104
_alert "That was a rhetorical question. <3"
103105
}
104106

@@ -108,14 +110,17 @@ if ! type _helpful >/dev/null 2>&1; then
108110

109111
# Intercept accidental invocation of `yes` and `n`, which are actual programs
110112
for name in n no y yes; do
111-
alias $name=_question
113+
alias $name=_rhetocial
112114
done
113115

114116
# Output help
115117
local output=$(_ansi "$1")
116118
_alert "$output"
117119
}
118120
fi
121+
if ! type _helped >/dev/null 2>&1; then
122+
function _helped() { :; } # Silent
123+
fi
119124
if ! type _helpless >/dev/null 2>&1; then
120125
function _helpless() { :; } # Silent
121126
fi

opt/cs50/bin/help50

+14-1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,16 @@ function _start() {
5656
fi
5757
}
5858

59+
function _status() {
60+
if [[ -n "$HELP50" ]]; then
61+
echo started
62+
return 0
63+
else
64+
echo stopped
65+
return 1
66+
fi
67+
}
68+
5969
function _stop() {
6070

6171
# If not helping
@@ -84,11 +94,14 @@ case "$1" in
8494
start)
8595
_start
8696
;;
97+
status)
98+
_status
99+
;;
87100
stop)
88101
_stop
89102
;;
90103
*)
91-
echo "Usage: $0 [disable|enable|is-enabled|start|stop]"
104+
echo "Usage: $0 [disable|enable|is-enabled|start|status|stop]"
92105
exit 1
93106
;;
94107
esac

0 commit comments

Comments
 (0)