module Help( bugMsg, getHelpTable, usageHeader, usageTrailer ) where import GenUtil(buildTableRL, indentLines) import KeyName {-# NOINLINE usageHeader #-} {-# NOINLINE usageTrailer #-} {-# NOINLINE bugMsg #-} {-# NOINLINE getHelpTable #-} usageHeader :: String usageTrailer :: String bugMsg :: String usageHeader = "Usage: ginsu [OPTION...] categories..." usageTrailer = unlines [ "For more information see the homepage at", " ", "To report a bug go to:", " ", "When reporting a bug, include the last few lines of ~/.gale/ginsu.errorlog if it seems appropriate." ] bugMsg = unlines [ "There has been an internal error", "verify the output of ginsu --checkconfig and", "please inform or file a bug report at", "", "Include the following text in any error report:" ] getHelpTable = do ht <- getKeyHelpTable (0,0) return ("Keybindings:\n" ++ indentLines 2 ht ++ filters ++ "\nFor more info see the manual at\n http://repetae.net/john/computer/ginsu/ginsu-manual.html\n") filters = "\nFilter Reference:\n" ++ indentLines 2 (unlines (buildTableRL [ ("",""), ("Primitive Filters:",""), (" ~a:","author of puff"), (" ~c:","category puff was sent too"), (" ~k:","regex match against keyword"), (" ~s:","regex match against senders real name"), (" ~b:","regex match against message body"), (" /","search for in visible fragments"), ("",""), ("Combining Filters:",""), (" A ; B", "Filter A or filter B"), (" A B", "Filter A and filter B"), (" !A", "Not filter A"), (" (A)", "Grouping, same as filter A"), (" /'foo bar'", "Single quotes are used to quote strings") ])) ++ "\n" ++ filterExamples filterExamples = "Filter Examples:\n" ++ indentLines 4 (unlines es) where es = [ "(~a:john@ugcs.caltech.edu)\n all puffs by john@ugcs", "(~c:pub.tv.buffy ~a:jtr@ofb.net)\n puffs from jtr and to pub.tv.buffy", "(/ginsu ; ~c:pub.gale.ginsu)\n puffs containing the word ginsu or directed to pub.comp.ginsu", "(!~k:spoil)\n no spoilers", "(~c:pub.tv.buffy !~c:pub.meow)\n puffs to buffy which are not about cats" ] {- paragraph maxn xs = drop 1 (f maxn (words xs)) where f n (x:xs) | lx <- length x + 1, lx < n = (' ':x) ++ f (n - lx) xs f n (x:xs) = '\n': (x ++ f (maxn - length x) xs) f n [] = "\n" keys = buildTableRL [ ("Keys:", ""), ("", "Help Screen"), ("", "Main Screen"), ("", "Presence Status Screen"), ("",""), ("j","next puff"), ("k","previous puff"), ("","first puff"), ("","last puff"), (" ","forward one line"), (" ","back one line"), (" ","forward one page"), (" ","back one page"), ("","forward one half-page"), ("","back one half-page"), ("",""), ("d","Show puff details"), ("v","Visit links in puff"), ("",""), ("c ~","add new filter"), ("u","pop one filter"), ("U","pop all filters"), ("!","invert filter at top of stack"), ("x","swap top two filters on stack"), ("a","filter to current author"), ("t","filter to current thread"), ("T","filter to strict thread"), ("m[1-9]","set mark - save current filter stack at given key"), ("[1-9]","recall filter stack saved here with 'm'"), ("C[1-9]","recall filter stack and add it to current filter stack"), ("",""), ("f","follow-up to category"), ("p","compose new puff"), ("r","reply to author"), ("g","group reply, sends to recipients and author of puff"), ("R","resend selected puff"), ("N","modify public presence string"), ("",""), ("","reconnect to all servers"), ("E","edit and reload configuration file"), ("q Q","quit program"), ("","redraw screen") ] -}