Skip to content

Commit 3e9ca9e

Browse files
committed
WIP
1 parent 56d8fb7 commit 3e9ca9e

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ RUN apt update && \
186186
expect `# For help50` \
187187
file `# For help50` \
188188
fonts-noto-color-emoji `# For render50` \
189+
fzf `# For help50` \
189190
gdb \
190191
git \
191192
git-lfs \

etc/profile.d/help50.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ function _help50() {
8181
# Try to get help
8282
for helper in $HELPERS/*; do
8383
if [[ -f $helper && -x $helper ]]; then
84-
echo "[$helper]"
8584
local help=$($helper $argv <<< "$typescript")
8685
if [[ -n "$help" ]]; then
8786
break
@@ -100,7 +99,7 @@ function _help50() {
10099
}
101100

102101
function _question() {
103-
_alert "That was a rhetorical question. :)"
102+
_alert "That was a rhetorical question. <3"
104103
}
105104

106105
# Default helpers

opt/cs50/lib/cli

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function _find() {
3232
return
3333
fi
3434

35-
# Find $path in descendants of $WORKDIR, excluding hidden directories
35+
# Find $path in descendants of $WORKDIR, excluding hidden directories, most recently modified first
3636
paths=$(find "$WORKDIR" -not -path "*/.*" -name "$path" -printf "%T+ %p\n" $type | sort -nr | awk '{print $2}' 2> /dev/null)
3737

3838
# Count paths

opt/cs50/lib/help50/bash

+11-3
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ if [[ "$output" =~ $regex ]]; then
6767
fi
6868

6969
# touch foo.c && ./foo.c
70-
regex="bash: \./(([^:]*)\.c): Permission denied"
70+
regex="bash: \./((.*)\.c): Permission denied"
7171
if [[ "$output" =~ $regex ]]; then
7272

7373
# If file exists
@@ -77,6 +77,7 @@ if [[ "$output" =~ $regex ]]; then
7777
fi
7878
fi
7979

80+
# touch foo.py && ./foo.py
8081
regex="bash: \./(.*\.py): Permission denied"
8182
if [[ "$output" =~ $regex ]]; then
8283

@@ -87,11 +88,18 @@ if [[ "$output" =~ $regex ]]; then
8788
fi
8889
fi
8990

91+
# echo "int main(void) {}" > foo && ./foo
92+
regex="bash: \./([^\.]*): Permission denied"
93+
if [[ "$output" =~ $regex ]]; then
94+
if [[ $(file --brief --mime-type "${BASH_REMATCH[1]}") == "text/x-c" ]]; then
95+
echo "Did you mean to give \`"${BASH_REMATCH[1]}"\` a name of \`"${BASH_REMATCH[1]}".c\` (and then compile it with \`make\`) instead?"
96+
exit
97+
fi
98+
fi
99+
90100
# touch foo && /.foo
91101
regex="bash: /\.([^:]*): No such file or directory"
92102
if [[ "$output" =~ $regex ]]; then
93-
94-
# If file exists
95103
if [[ -f "${BASH_REMATCH[1]}" ]]; then
96104
echo "Did you mean to run \`./${BASH_REMATCH[1]}\`?"
97105
exit

0 commit comments

Comments
 (0)