summaryrefslogtreecommitdiff
path: root/functions/normalize_filename.pp
diff options
context:
space:
mode:
Diffstat (limited to 'functions/normalize_filename.pp')
-rw-r--r--functions/normalize_filename.pp7
1 files changed, 7 insertions, 0 deletions
diff --git a/functions/normalize_filename.pp b/functions/normalize_filename.pp
new file mode 100644
index 0000000..6910936
--- /dev/null
+++ b/functions/normalize_filename.pp
@@ -0,0 +1,7 @@
+# Should take any string, and replace all non-character letters with
+# dashes, and downcase everything.
+function xorg::normalize_filename (
+ String $name,
+) >> String {
+ $name.downcase().regsubst(/[^a-z0-9]/, '-')
+}