Commit 73ee55a2 authored by Nicolas Lenz's avatar Nicolas Lenz
Browse files

Add per-style help to the help message.

parent bf280c7d
......@@ -3,6 +3,7 @@
module Main where
import Mock (styles)
import Mock.Help (styleHelp)
import qualified Data.Text as T
import qualified Data.Text.IO as T
import Data.Char
......@@ -30,7 +31,13 @@ handle style = fromMaybe (const help) (lookup style styles) . T.dropWhileEnd isS
-- |Help string.
help :: T.Text
help = T.unlines [
"Mock 3.0.0 - a program to transform text.",
" - Mock 3.0.0 - ",
"A Great PrOgrAM tO TRANsFoRM TEXt, wRiTten iN HaSKeLL.",
"By Nicolas Lenz. Free and open source under the WTFPL.",
"Webpage (source code, issues, pull requests): https://git.eisfunke.com/software/mock",
"",
"Usage: mock [STYLE] [TEXT]",
"Styles: " `T.append` (T.intercalate ", " $ map fst styles)]
"Help: mock --help",
"",
"Styles: ",
T.intercalate "\n" (map (\(name, _) -> T.concat [" - ", name, ": ", styleHelp name]) styles)]
......@@ -4,7 +4,7 @@ cabal-version: 2.2
--
-- see: https://github.com/sol/hpack
--
-- hash: c163d71c387a66e9f2b69128f77418f0edb7d266751fbe7ec2aa40443511d5d0
-- hash: 72ef52c2162b8348d893d8b683bbf0a315e414192ee8d68cc9bf5dbb8f9c45d4
name: mock
version: 3.2.1
......@@ -27,6 +27,7 @@ source-repository head
library
exposed-modules:
Mock
Mock.Help
other-modules:
Paths_mock
hs-source-dirs:
......
......@@ -15,6 +15,7 @@ styles :: [(Text, Text -> Text)]
styles = [
("random", mockRandom),
("alternate", mockAlternate),
("strike", strikethrough),
("space", letterspace 1),
("space2", letterspace 2),
("space3", letterspace 3),
......@@ -25,8 +26,7 @@ styles = [
("dedouble", T.map fromDouble),
("cc", mockCC),
("b", mockB),
("square", mockSquare),
("strike", strikethrough)]
("square", mockSquare)]
-- |Transforms a String into uppercase where the corresponding list is True. For False the String isn't changed.
toUpperBy :: [Bool] -> T.Text -> T.Text
......
{-# LANGUAGE OverloadedStrings #-}
module Mock.Help (styleHelp) where
import qualified Data.Text as T
import Data.Text (Text)
styleHelp :: Text -> Text
styleHelp styleName = case styleName of
"random" -> " Flips lowercase characters pseudo-randomly into uppercase letters."
"alternate" -> "Flips every second letter into an uppercase one, starting with the second character."
"space" -> " Inserts a s p a c e between every two characters."
"space2" -> " Inserts two s p a c e s between every two characters."
"space3" -> " Inserts three s p a c e s between every two characters."
"lines" -> " Puts each character on a single line."
"upper" -> " Turns all characters into UPPERCASE ones."
"lower" -> " Turns all characters into lowercase ones."
"double" -> " Turns characters (latin letters and numbers) into their double-struck variants (𝕖𝕩𝕒𝕞𝕡𝕝𝕖). Also known as blackboard bold."
"dedouble" -> " Turns double-struck characters (like from the \"double\" style) back into normal ones."
"cc" -> " Replaces all occurences of lowercase \"c\", \"ck\" and \"k\" with \"cc\"."
"b" -> " Replaces all occurences of Bs (lower- and uppercase) with B-button emojis (🅱)."
"square" -> " Shows the input spaced in the first line and the tail of the input lined afterwards."
"strike" -> " Turns the input into strikethrough using Unicode combinators (e̶x̶a̶m̶p̶l̶e̶)."
_ -> "No documentation available."
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment