From 1219ef791bf56d6f4c1cb5d31573d18aa7aa1b9a Mon Sep 17 00:00:00 2001 From: Dmitry Voronin Date: Wed, 31 Jan 2024 18:41:02 +0300 Subject: [PATCH] Parse : Rename parse_simplify to parse_simple. --- .config/bash/module/Name.sh | 4 ++-- .config/bash/module/Parse.sh | 14 +++++++------- .doc/Bash.md | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.config/bash/module/Name.sh b/.config/bash/module/Name.sh index 13aa3c1..e655d12 100644 --- a/.config/bash/module/Name.sh +++ b/.config/bash/module/Name.sh @@ -217,9 +217,9 @@ function name_music() { local ext=${target##*.} if [[ -d "${target}" ]]; then - local new_name="$(parse_titlecase $(parse_simplify ${target%.*}))" + local new_name="$(parse_titlecase $(parse_simple ${target%.*}))" else - local new_name="$(parse_titlecase $(parse_simplify ${target%.*})).${ext}" + local new_name="$(parse_titlecase $(parse_simple ${target%.*})).${ext}" fi # Skip on no change. diff --git a/.config/bash/module/Parse.sh b/.config/bash/module/Parse.sh index 9e5b7a0..6db05e9 100644 --- a/.config/bash/module/Parse.sh +++ b/.config/bash/module/Parse.sh @@ -2,8 +2,8 @@ _PARSE_ALLOWED_CHARS="_-" _PARSE_SPLIT_CHARS="\.\ _-" # Parse data and output simplified format. -# Usage: parse_simplify -function parse_simplify() { +# Usage: parse_simple +function parse_simple() { echo "${*}" | sed \ -e "s/[${_PARSE_SPLIT_CHARS}]/_/g" \ -e "s/[^[:alnum:]${_PARSE_ALLOWED_CHARS}]//g" \ @@ -16,7 +16,7 @@ function parse_simplify() { # Parse to PascalCase. # Usage: parse_pascal function parse_pascal() { - local parts=($(_get_parts $(parse_simplify "${*}"))) + local parts=($(_get_parts $(parse_simple "${*}"))) local result for part in "${parts[@]}"; do @@ -31,7 +31,7 @@ function parse_pascal() { # Parse to snake_case. # Usage: parse_snake function parse_snake() { - local parts=($(_get_parts $(parse_simplify "${*}"))) + local parts=($(_get_parts $(parse_simple "${*}"))) local result for part in "${parts[@]}"; do @@ -45,7 +45,7 @@ function parse_snake() { # Parse to kebab-case. # Usage: parse_kebab function parse_kebab() { - local parts=($(_get_parts $(parse_simplify "${*}"))) + local parts=($(_get_parts $(parse_simple "${*}"))) local result for part in "${parts[@]}"; do @@ -59,7 +59,7 @@ function parse_kebab() { # Parse to camelCase. # Usage: parse_camel function parse_camel() { - local parts=($(_get_parts $(parse_simplify "${*}"))) + local parts=($(_get_parts $(parse_simple "${*}"))) local result for part in "${parts[@]}"; do @@ -74,7 +74,7 @@ function parse_camel() { # Parse to SNAKE_CASE_UPPERCASE. **NOT STABLE! Repeating results in different output.** # Usage: parse_snake_uppercase function parse_snake_uppercase() { - local parts=($(_get_parts $(parse_simplify "${*}"))) + local parts=($(_get_parts $(parse_simple "${*}"))) local result for part in "${parts[@]}"; do diff --git a/.doc/Bash.md b/.doc/Bash.md index 5d8299e..ef90784 100644 --- a/.doc/Bash.md +++ b/.doc/Bash.md @@ -299,7 +299,7 @@ Command|Description Command|Description ---|--- -`parse_simplify `|Parse data and output simplified format. +`parse_simple `|Parse data and output simplified format. `parse_pascal `|Parse to PascalCase. `parse_snake `|Parse to snake_case. `parse_kebab `|Parse to kebab-case.