Code Monkey home page Code Monkey logo

stutter's Introduction

sc_check-sections
examples

Stutter

Build Status

Stutter is a string utterer.

utterer: someone who expresses in language; someone who talks (especially someone who delivers a public speech or someone especially garrulous) (www.vocabulary.com)

Stutter takes a string definition and crafts as many different strings as it can. See the examples section below for inspiration.

Installing

Download

You can download the latest release build from the release page. The executable depends on the gmp library (needed by the Haskell runtime system), which is most likely already present on your system. If not, install it from your favorite package manager. For Ubuntu:

$ sudo apt-get install libgmp-dev

Make sure stutter is on your PATH.

Nix

If you have nix installed, you can install stutter with the following command:

$ nix-env -i stutter

Building

The recommended way is to build stutter with stack. Run the following command in the cloned repo:

$ stack build

You can then install it with

$ stack install

Contributing

There are several ways you can contribute:

  • Complain: Just open an issue and let me know what could be improved.
  • Share a use-case: You found a cool case? Great! open an issue or (even better) a PR with your issue added to the examples below.
  • Support: Share stutter with your friends, you never know who might need it.
  • Implement: All PRs are welcome.

Examples

Stutter can be used as a very simple echo clone:

$ stutter 'Hello, World!'
Hello, World!

But stutter also knows how to enumerate:

$ stutter 'foo|bar|baz'
foo
bar
baz

You can easily specify which parts you want to enumerate, and which parts should always be there:

$ stutter 'My name is (what\?|who\?|Slim Shady)'
My name is what?
My name is who?
My name is Slim Shady

Stutter can also enumerate file contents:

$ stutter 'foo|bar|baz' > test.txt
$ stutter '(@test.txt) -- stutter was here'
foo -- stutter was here
bar -- stutter was here
baz -- stutter was here

And read from stdin:

$ cat test.txt | stutter 'Check this out, paste: @-'
Check this out, paste: foo
Check this out, paste: bar
Check this out, paste: baz

Stutter also likes ranges:

$ stutter '[0-9a-f]'
0
1
2
3
4
5
6
7
8
9
a
b
c
d
e
f

Of course, it can all be used together:

$ stutter 'My name is (@test.txt) [a-c] (who\?|what\?|Slim Shady)'
My name is foo a who?
My name is foo a what?
My name is foo a Slim Shady
My name is foo b who?
My name is foo b what?
...
My name is baz c who?
My name is baz c what?
My name is baz c Slim Shady

Stutter can teach you binary:

$ stutter '(0b(0|1){#|5})|I know binary!'
0b00000
0b00001
0b00010
0b00011
0b00100
0b00101
...
0b11010
0b11011
0b11100
0b11101
0b11110
0b11111
I know binary!

Stutter can repeat a char:

$ stutter 'a{42}'
a
a
a
...
$ stutter 'a{42}' | wc -l
42

Release checklist

  1. Make sure you're on (latest) master.

  2. Bump the version in stutter.cabal: 0.MAJOR.MINOR.PATCH.

Given a version number MAJOR.MINOR.PATCH, increment the:

MAJOR version when you make incompatible API changes, MINOR version when you add functionality in a backwards-compatible manner, and PATCH version when you make backwards-compatible bug fixes.

  1. Commit the updated stutter.cabal file with commit name Release v0.MAJOR.MINOR.PATCH.
  2. Tag the commit with git tag v0.MAJOR.MINOR.PATCH.
  3. Push with git push --follow-tags.
  4. Run cabal sdist and cabal upload --publish ./dist/stutter... to upload stutter to hackage.

stutter's People

Contributors

nmattia avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

stutter's Issues

Port system tests to haskell

"system tests" are implemented as a bash script. Having them written in haskell would make it easier to

  • Run them through the test-suite
  • Report failures
  • Maintain the tests

Add save file

Add support to save useful producers to a file:

words: (@/usr/share/dict/american-english)
days: Mon+Tue+Wed+Thu+Fri+Sat+Sun

and then

$ stutter '<days>'
Mon
Tue
...

Add zippers

In order to have:

$ stutter '[a-c]$[a-c]'
aa
bb
cc

Though unclear how to get the following behavior:

$ stutter '[a-c]$foo$[a-c]'
afooa
bfoob
cfooc

Add command to show output cardinality

It'd be useful to know how big the output will be :

$ stutter --length 'foo+bar'
2

When applicable, of course. We'd probably only support the non-IO operations (no files, handles, etc).

Remove ByteString uses

The module Stutter.Producer uses ByteStrings in some places, though it's not clear whether it's really needed. They could probably be replaced with functions from the text library.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.