cs50 / codespace

https://cs50.readthedocs.io/cs50/codespace
GNU General Public License v3.0
120 stars 352 forks source link

Adds duck-based help50 - don't merge yet #101

Closed dmalan closed 1 month ago

dmalan commented 1 year ago

TODOs

Screenshot 2023-07-24 at 12 05 12 PM

How to Try

  1. Run:

    sudo apt update && sudo apt install -y colorized-logs
  2. Run:

    sudo wget https://raw.githubusercontent.com/cs50/codespace/help50/etc/profile.d/duck.sh -P /etc/profile.d/
  3. Open new terminal and run a command that yields a non-0 exit status (e.g., cd foo)

Screenshot

Screenshot 2023-07-22 at 11 16 51 PM

Implementation Details

curiouskiwi commented 1 year ago

Works as expected. The only glitch I noticed is that the first error I did after opening a new tab did not trigger the ddb. Perhaps I was too quick?

/usr/bin/ld: /lib/x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x1b): undefined reference to `main'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [<builtin>: dictionary] Error 1
speller/ $ make dictionary
/usr/bin/ld: /lib/x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x1b): undefined reference to `main'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [<builtin>: dictionary] Error 1
[1]+  Done                    command50 ddb50.ask "$prompt"
speller/ $

did also notice that sometimes, the message send to ddb (and shown in the box) has unprintable chars overwriting some of it, like

Explain this error:
$ bavalgrind a valgrind: a: command not found

or

Explain this error:
$ jvalgrind valgrind: no program specified valgrind: Use --help for more information. 

The duck was still able to interpret correctly though.

edit to add I reproduced the "duck doesn't get the error" problem from before. It happens if the duck sidebar isn't already opened. I switched to the explorer, then had an error in the terminal. The duck sidebar opened, but the error message was never sent to it.