Giter Club home page Giter Club logo

slugify's Introduction

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

slugify's People

Contributors

jonstuebe avatar mayeu avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

slugify's Issues

Doesn't work with accentuated strings

Hi :)

I wanted to use this script to slugify some strings but it doesn't work with accentuated string, for example:

โžœ slugify "รฉeรฉ"
-e

Example from README doesnt work

Hi there <3

Just installed slugify using $ curl https://slugify.now.sh > slugify && chmod +x slugify && sudo mv slugify /usr/local/bin/ successfully. But running example from README ends with an error:

โžœ echo "I'm no slug ๐ŸŒ." | slugify
/usr/local/bin/slugify: 1: Syntax error: "(" unexpected

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.