Parse : Rename parse_simplify to parse_simple.

This commit is contained in:
Dmitry Voronin 2024-01-31 18:41:02 +03:00
parent 2836c4c0ab
commit 1219ef791b
3 changed files with 10 additions and 10 deletions

View file

@ -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.

View file

@ -2,8 +2,8 @@ _PARSE_ALLOWED_CHARS="_-"
_PARSE_SPLIT_CHARS="\.\ _-"
# Parse data and output simplified format.
# Usage: parse_simplify <STRING>
function parse_simplify() {
# Usage: parse_simple <STRING>
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 <STRING>
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 <STRING>
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 <STRING>
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 <STRING>
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 <STRING>
function parse_snake_uppercase() {
local parts=($(_get_parts $(parse_simplify "${*}")))
local parts=($(_get_parts $(parse_simple "${*}")))
local result
for part in "${parts[@]}"; do

View file

@ -299,7 +299,7 @@ Command|Description
Command|Description
---|---
`parse_simplify <STRING>`|Parse data and output simplified format.
`parse_simple <STRING>`|Parse data and output simplified format.
`parse_pascal <STRING>`|Parse to PascalCase.
`parse_snake <STRING>`|Parse to snake_case.
`parse_kebab <STRING>`|Parse to kebab-case.