neuro-inc/flow-template

Better slugify proposal

Closed this issue · 1 comments

Problem:

$ neuro project init
project_name [Neuro Project]: Elon Musk's super project
project_slug [elon-musk's-super-project]: 

So proposed slug is not always valid.

https://github.com/neuro-inc/cookiecutter-neuro-project/blob/94e218b50b9b0bb9c796fdbf36665b02f80acc17/cookiecutter.json#L3
cookiecutter.project_name.lower().replace(' ', '-').replace('_', '-') might be not enough. Better to use slugify:

pip install python-slugify

>>> from slugify import slugify
>>> txt = "This\ is/ a%#$ test ---"
>>> slugify(txt)
'this-is-a-test'

the only problem is how to make this package available in cookiecutter.json's jinja

not actual