macOS Terminal – How to Create Command Explainer Text

macosterminalunix

┌── ln(1) link, ln -- make links
│   ┌── Create a symbolic link.
│   │                         ┌── the optional path to the intended symlink
│   │                         │   if omitted, symlink is in . named as destination
│   │                         │   can use . or ~ or other relative paths
│   │                   ┌─────┴────────┐
ln -s /path/to/original /path/to/symlink
      └───────┬───────┘
              └── the path to the original file/folder
                  can use . or ~ or other relative paths

Found this useful method to explain Linux Commands, but have no idea how @grg did it.
Manually is very time consuming. Is there a tool to do stuff like this?

Source: How can I create a symbolic link in Terminal?

Best Answer

That's my answer! I did it manually, but used PressAndHold.app (built into macOS) to speed up entering the box drawing characters. The text was abridged from the man page manually.

By customising PressAndHold.app keys, basically editing /System/L*/Inp*/Pr*/*/P*/*/*/R*/ to add box drawing characters, I can type the characters directly into the text field whether here on SE or elsewhere.

Add the following to your language's keyboard file within that folder, such as ‘Keyboard-en.plist’ for an English keyboard layout. Open the plist with a text editor to paste the XML below, or open with Xcode and manually create the dictionary, pasting values as necessary. Replace ‘f’ with the key you wish to use. You can then insert box drawing characters by holding down the key and then selecting a number, or if you have a Touch Bar the keys appear there too with High Sierra.

<!-- f: box drawing characters -->
<key>Roman-Accent-f</key>
<dict>
  <key>Direction</key>
  <string>right</string>
  <key>Keycaps</key>
  <string>─ │ ┌ ┐ └ ┘ ├ ┬ ┤ ┴ ┼</string>
  <key>Strings</key>
  <string>─ │ ┌ ┐ └ ┘ ├ ┬ ┤ ┴ ┼</string>
</dict>