From 7dfe2a5690abdce4c9b18b1bfee89ee190d292f9 Mon Sep 17 00:00:00 2001 From: self Date: Sun, 1 Jan 2023 03:00:50 +0000 Subject: intokebab --- zsh/.zshrc-fn | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/zsh/.zshrc-fn b/zsh/.zshrc-fn index 526b435..0d7e707 100644 --- a/zsh/.zshrc-fn +++ b/zsh/.zshrc-fn @@ -24,3 +24,8 @@ sv() { pvd() { mpv *$1* } + +# Change a string into its kebab style, e.g. all-lower-case-with-dashes. +intokebab() { + echo "$1" | tr ' ' '-' | tr '[:upper:]' '[:lower:]' | sed 's/[^a-zA-Z-]//g' +} -- cgit v1.2.1