Mayeu / slugify

🐌 A simple tool to create slugs in your shell. One file, no dependencies.

Home Page:https://slugify.now.sh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Slugify 🐌

A simple and dependency free slugifier for your CLI. POSIX compatible.

Work on macOS and GNU/Linux πŸš€
TL;DR: input | slugify > output

Terminal badge Travis Pipeline status badge pipeline status GitHub release badge

πŸ‘‰ This is a really simple (aka "featureless") tool to generate slugs 🐌 directly from your command line. It does not have any option by design and work best by piping one line at a time to it:

$ echo "I'm no slug 🐌." | slugify
i-m-no-slug

It does not aim to be perfect since the goal is to be able to use it in a drop & run fashion (aka curling & praying πŸ™).

πŸ’» Install

If you are the adventurous kind, you can simply curl & install the script directly from the web 🌐. Here is a one-liner that may break your system:

$ curl https://slugify.vercel.app > slugify && chmod +x slugify && sudo mv slugify /usr/local/bin/

(Yes, this will ask for your password, as stated before this may break your system. Paste with care.)

Otherwise, just clone this repository somewhere and manually copy the slugify script anywhere your $PATH point to (my favorite place is my ~/bin folder):

$ git clone https://github.com/Mayeu/slugify
$ cd slugify
$ cp slugify ~/bin/

πŸ”¨ How to use

The best way to use this tool is to directly pipe a line to it:

$ echo 'Slug me bΓ©bΓ©!!1!' | slugify
slug-me-b-b-1

But you can also pass the line to slug as an argument. Be sure to quote your text!

$ slugify "I'm no slug."
i-m-no-slug

Finally, you can see the minimal help by calling the script without any argument:

$ slugify
Usage: slugify text
       echo text | slugify

πŸ’― Testing

To run the test, you need bats(1) installed. Then you can simply run:

$ make test

Right now, the tests are not actually running in a minimal POSIX compliant shell but in bash πŸ˜’. This is a work in progress 🚧, you can give a hand if you have one to spare.

The tests are automatically run on each commits (including Pull Requests) with the help of Travis CI, and GitLab. The following OS are tested:

  • Travis CI:
    • Ubuntu 14.04
    • macOS
  • GitLab:
    • Alpine 3.5, 3.6, 3.7, 3.8, edge
    • Archlinux
    • Centos 6, 7
    • Debian oldstable, stable, testing, unstable
    • Fedora 27, 28, 29, Rawhide
    • Ubuntu 14.04 LTS, 16.04 LTS, 18.04 LTS, 18.10

Right now there is no automated test for our BSD friends, I would love to setup some, poke me if you know how I could do that on the cheap (i.e.: free as in :beer:).

πŸ”„ Versionning

This project uses SemVer. The public API is defined as the possible interaction with the tool via the shell.

πŸ‘‹ Authors

πŸ“ License

This software is distributed under the GPLv3 license. Please check the LICENSE.md file.

🐌 Embrace the slug

Propaganda poster for the brain slug federation. Picturing Fry from the Futurama show being controlled by a brain slug

About

🐌 A simple tool to create slugs in your shell. One file, no dependencies.

https://slugify.now.sh

License:GNU General Public License v3.0


Languages

Language:Shell 79.3%Language:Makefile 20.7%