Skip to content

Instantly share code, notes, and snippets.

@pvergain
Created December 6, 2022 08:44
Show Gist options
  • Save pvergain/d77030433a59ccba27c5dcf3773ac806 to your computer and use it in GitHub Desktop.
Save pvergain/d77030433a59ccba27c5dcf3773ac806 to your computer and use it in GitHub Desktop.
call slugify from the command line
"""slug.py
- https://github.com/un33k/python-slugify
Exemple d'appel
==================
::
python slug.py --text "un projet gitlab pour les issues"
::
un-projet-gitlab-pour-les-issues
::
python slug.py --text "un projet gitlab pour les Issues très graves"
::
un-projet-gitlab-pour-les-issues-tres-graves
"""
import sys
from slugify import slugify
def get_slug(text: str):
slug = slugify(text)
print(slug)
if __name__ == "__main__":
"""Point d'entrée du script Python."""
text = ""
for i, argument in enumerate(sys.argv):
if argument == "--text":
text = sys.argv[i + 1]
get_slug(text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment