Commit 54ce3e1a authored by Nicolas Lenz's avatar Nicolas Lenz ❄️
Browse files

Merge branch 'master' of git.eisfunke.com:software/Mock

parents ed0df34c af0b4216
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
# ---> Haskell
mock.cabal
dist
dist-*
cabal-dev
@@ -19,4 +20,3 @@ cabal.sandbox.config
.stack-work/
cabal.project.local
.HTF/
+13 −10
Original line number Diff line number Diff line
@@ -2,40 +2,43 @@

![wAR miR jEtzT Zu anSTRENgEnd dA JedeN ZWEiten BUChSTaBeN GRoSS zU scHREiBen](mock.png)

There is a **Telegram bot** for Mock available as [\@truemockbot](https://t.me/truemockbot), you can find its source code in the [repository](https://git.eisfunke.com/software/mock-telegram-bot).

## Installation

Just clone this repository or download a [release](https://git.eisfunke.com/software/mock/releases) and call

```
$> stack setup
$> stack install
$ stack install
```

This will install Mock into `~/.local/bin`, which should be added to `$PATH`.
inside the folder. This will install Mock into `~/.local/bin`, which should be added to `$PATH`.

There is also an [AUR package](https://aur.archlinux.org/packages/haskell-mock/) available.
If you're using Arch Linux: there is also an [AUR package](https://aur.archlinux.org/packages/haskell-mock/) available.


## Usage

`mock [STYLE] [TEXT]`

You can get a list of possible mock styles with `mock`.
You can get help a list of possible mock styles with `mock`.

If no text is given, input is read from `stdin`.
If no text or "-" is given, input is read from `stdin`.

### Examples

```
$> mock random This is a great program.
$ mock random This is a great program.
ThIs Is A greaT PROgrAM.

$> mock space This is a great program.
$ mock space This is a great program.
T h i s   i s   a   g r e a t   p r o g r a m.
```

Mock calls can be concatenated with pipes:
Mock calls can of course be concatenated with pipes:

```
$> mock space This is a great program. | mock random
$ mock space This is a great program. | mock random
T h I S   i S   A   G R e A t   P R o g r a m .
```

+6 −6
Original line number Diff line number Diff line
{-# LANGUAGE OverloadedStrings #-}

module Main where

import Mock (styles)
import Mock.Help (styleHelp)
import Text.Mock
import Text.Mock.Help
import qualified Data.Text as T
import qualified Data.Text.IO as T
import Data.Char
import Data.Maybe
import System.Environment


-- |Main function.
main :: IO ()
main = do
@@ -22,6 +19,9 @@ main = do
        [style] -> do
            input <- T.getContents  -- Read from stdin
            T.putStrLn $ handle style [input]
        [style, "-"] -> do
            input <- T.getContents  -- Read from stdin
            T.putStrLn $ handle style [input]
        (style:str) -> T.putStrLn $ handle style str

-- |Returns an IO action handling the given list of arguments.
@@ -32,7 +32,7 @@ handle style = fromMaybe (const help) (lookup style styles) . T.dropWhileEnd isS
help :: T.Text
help = T.unlines [
    " ╔════════════════════╗",
    " ║     Mock 3.3.0     ║",
    " ║     Mock " <> version <> "     ║",
    " ╚════════════════════╝",
    "",
    "A Great PrOgrAM tO TRANsFoRM TEXt, wRiTten iN HaSKeLL.",

mock.cabal

deleted100644 → 0
+0 −55
Original line number Diff line number Diff line
cabal-version: 2.2

-- This file has been generated from package.yaml by hpack version 0.31.1.
--
-- see: https://github.com/sol/hpack
--
-- hash: 25216876ead15fc7d80c86db52d327284f1e1e11704a736cec1d15280cc22ed3

name:           mock
version:        3.3.0
synopsis:       GrEAt HAskeLL PrOGRaM to trANsForm tEXT
description:    Please see the README at <https://git.eisfunke.com/software/mock#readme>
category:       String
author:         Nicolas Lenz
maintainer:     nicolas@eisfunke.com
copyright:      2018 Nicolas Lenz
license:        WTFPL
license-file:   LICENSE
build-type:     Simple
extra-source-files:
    README.md

source-repository head
  type: git
  location: https://git.eisfunke.com/software/mock

library
  exposed-modules:
      Mock
      Mock.Help
  other-modules:
      Paths_mock
  hs-source-dirs:
      src
  build-depends:
      base >=4.7 && <5
    , hashable
    , random
    , text
  default-language: Haskell2010

executable mock
  main-is: Main.hs
  other-modules:
      Paths_mock
  hs-source-dirs:
      app
  ghc-options: -threaded -rtsopts -with-rtsopts=-N
  build-depends:
      base >=4.7 && <5
    , hashable
    , mock
    , random
    , text
  default-language: Haskell2010
+27 −24
Original line number Diff line number Diff line
name: mock
version:             3.4.0
version: 3.6.0
license: WTFPL
git:                 "https://git.eisfunke.com/software/mock"
author:              "Nicolas Lenz"
maintainer:          "nicolas@eisfunke.com"
copyright:           "2018 Nicolas Lenz"

extra-source-files:
- README.md
git: https://git.eisfunke.com/software/mock
author: Nicolas Lenz
maintainer: nicolas@eisfunke.com
copyright: 2018-2019 Nicolas Lenz

synopsis: GrEAt HAskeLL PrOGRaM to trANsForm tEXT
category:            String
description:         Please see the README at <https://git.eisfunke.com/software/mock#readme>
category: Text
description: Please see the README at <https://git.eisfunke.com/software/mock#readme>.

dependencies:
- base >= 4.7 && < 5
  - base
  - text
  - random
  - hashable
- text

extra-doc-files:
  - README.md

library:
  source-dirs: src
  ghc-options:
    - -Wall

executables:
  mock:
    main:                Main.hs
    source-dirs: app
    main: main.hs
    dependencies:
      - mock
    ghc-options:
      - -Wall
      - -threaded
      - -rtsopts
      - -with-rtsopts=-N
    dependencies:
    - mock
Loading