Cli-love/helpme revision idea

From Pandora Wiki
Jump to: navigation, search


Simplify everything by moving all data into a separate document. This document can be made portable between the wiki and CLI Love itself.

Move the list into its own document. Then it can be downloaded with something like:

\wget -O helpme.txt

# Scan a text file
# Look for given search string
# If found
  # Print lines which have a string with spaces
  # Stop at the first blank line.
# IDEA:  Instead of directly echoing the text, build a variable.  Then use `less` to display it.  But frankly, if a description is that long, something is very wrong.
# IDEA:  Go back through the list and display all associated commands.
#        This would be pretty annoying to do.
# Assumptions:
#   Commands do not have spaces in them.
# TODO:  Redo the text file format so that it's copy-pasteable between the text file and the wiki.
  # Display lines
  #   with a space
  #   or starting with http
  pattern=\ \|^http
  if [[ "$1" =~ $pattern  ]]; then
    \echo -e "$1"
checker() {
  # Scan a text file
  while \read line; do
    # Look for given search string
    if [[ $1 == $line ]]; then
    if [[ $found == "true" ]]; then
      # Stop at the first blank line.
      if [[ "$line" == "" ]]; then
      # Print lines which have a string with spaces
      echo_if_has_spaces "$line"
  # (Scan a text file)
  done < <( \cat helpme.txt )
  if [[ $found == "false" ]]; then
    \echo sorry, not found
checker first
#checker example
#checker second
#checker failure


This is an example description.  It is one paragraph.
\\nSlash sequences are allowed (see man echo), but must be double-escaped.
\  \\\\\\     backslash
\  \\\\a     alert (BEL)
\  \\\\b     backspace
\  \\\\c     produce no further output
\  \\\\e     escape
\  \\\\f     form feed
\  \\\\n     new line
\  \\\\r     carriage return
\  \\\\t     horizontal tab
\  \\\\v     vertical tab
\  \\\\0NNN  byte with octal value NNN (1 to 3 digits)
\  \\\\xHH   byte with hexadecimal value HH (1 to 2 digits)
Spaces at the beginning of a line must begin with a \\  \\n

This is a second program.