Parse : Rename parse_simplify to parse_simple.
This commit is contained in:
parent
2836c4c0ab
commit
1219ef791b
|
@ -217,9 +217,9 @@ function name_music() {
|
||||||
local ext=${target##*.}
|
local ext=${target##*.}
|
||||||
|
|
||||||
if [[ -d "${target}" ]]; then
|
if [[ -d "${target}" ]]; then
|
||||||
local new_name="$(parse_titlecase $(parse_simplify ${target%.*}))"
|
local new_name="$(parse_titlecase $(parse_simple ${target%.*}))"
|
||||||
else
|
else
|
||||||
local new_name="$(parse_titlecase $(parse_simplify ${target%.*})).${ext}"
|
local new_name="$(parse_titlecase $(parse_simple ${target%.*})).${ext}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Skip on no change.
|
# Skip on no change.
|
||||||
|
|
|
@ -2,8 +2,8 @@ _PARSE_ALLOWED_CHARS="_-"
|
||||||
_PARSE_SPLIT_CHARS="\.\ _-"
|
_PARSE_SPLIT_CHARS="\.\ _-"
|
||||||
|
|
||||||
# Parse data and output simplified format.
|
# Parse data and output simplified format.
|
||||||
# Usage: parse_simplify <STRING>
|
# Usage: parse_simple <STRING>
|
||||||
function parse_simplify() {
|
function parse_simple() {
|
||||||
echo "${*}" | sed \
|
echo "${*}" | sed \
|
||||||
-e "s/[${_PARSE_SPLIT_CHARS}]/_/g" \
|
-e "s/[${_PARSE_SPLIT_CHARS}]/_/g" \
|
||||||
-e "s/[^[:alnum:]${_PARSE_ALLOWED_CHARS}]//g" \
|
-e "s/[^[:alnum:]${_PARSE_ALLOWED_CHARS}]//g" \
|
||||||
|
@ -16,7 +16,7 @@ function parse_simplify() {
|
||||||
# Parse to PascalCase.
|
# Parse to PascalCase.
|
||||||
# Usage: parse_pascal <STRING>
|
# Usage: parse_pascal <STRING>
|
||||||
function parse_pascal() {
|
function parse_pascal() {
|
||||||
local parts=($(_get_parts $(parse_simplify "${*}")))
|
local parts=($(_get_parts $(parse_simple "${*}")))
|
||||||
local result
|
local result
|
||||||
|
|
||||||
for part in "${parts[@]}"; do
|
for part in "${parts[@]}"; do
|
||||||
|
@ -31,7 +31,7 @@ function parse_pascal() {
|
||||||
# Parse to snake_case.
|
# Parse to snake_case.
|
||||||
# Usage: parse_snake <STRING>
|
# Usage: parse_snake <STRING>
|
||||||
function parse_snake() {
|
function parse_snake() {
|
||||||
local parts=($(_get_parts $(parse_simplify "${*}")))
|
local parts=($(_get_parts $(parse_simple "${*}")))
|
||||||
local result
|
local result
|
||||||
|
|
||||||
for part in "${parts[@]}"; do
|
for part in "${parts[@]}"; do
|
||||||
|
@ -45,7 +45,7 @@ function parse_snake() {
|
||||||
# Parse to kebab-case.
|
# Parse to kebab-case.
|
||||||
# Usage: parse_kebab <STRING>
|
# Usage: parse_kebab <STRING>
|
||||||
function parse_kebab() {
|
function parse_kebab() {
|
||||||
local parts=($(_get_parts $(parse_simplify "${*}")))
|
local parts=($(_get_parts $(parse_simple "${*}")))
|
||||||
local result
|
local result
|
||||||
|
|
||||||
for part in "${parts[@]}"; do
|
for part in "${parts[@]}"; do
|
||||||
|
@ -59,7 +59,7 @@ function parse_kebab() {
|
||||||
# Parse to camelCase.
|
# Parse to camelCase.
|
||||||
# Usage: parse_camel <STRING>
|
# Usage: parse_camel <STRING>
|
||||||
function parse_camel() {
|
function parse_camel() {
|
||||||
local parts=($(_get_parts $(parse_simplify "${*}")))
|
local parts=($(_get_parts $(parse_simple "${*}")))
|
||||||
local result
|
local result
|
||||||
|
|
||||||
for part in "${parts[@]}"; do
|
for part in "${parts[@]}"; do
|
||||||
|
@ -74,7 +74,7 @@ function parse_camel() {
|
||||||
# Parse to SNAKE_CASE_UPPERCASE. **NOT STABLE! Repeating results in different output.**
|
# Parse to SNAKE_CASE_UPPERCASE. **NOT STABLE! Repeating results in different output.**
|
||||||
# Usage: parse_snake_uppercase <STRING>
|
# Usage: parse_snake_uppercase <STRING>
|
||||||
function parse_snake_uppercase() {
|
function parse_snake_uppercase() {
|
||||||
local parts=($(_get_parts $(parse_simplify "${*}")))
|
local parts=($(_get_parts $(parse_simple "${*}")))
|
||||||
local result
|
local result
|
||||||
|
|
||||||
for part in "${parts[@]}"; do
|
for part in "${parts[@]}"; do
|
||||||
|
|
|
@ -299,7 +299,7 @@ Command|Description
|
||||||
|
|
||||||
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_pascal <STRING>`|Parse to PascalCase.
|
||||||
`parse_snake <STRING>`|Parse to snake_case.
|
`parse_snake <STRING>`|Parse to snake_case.
|
||||||
`parse_kebab <STRING>`|Parse to kebab-case.
|
`parse_kebab <STRING>`|Parse to kebab-case.
|
||||||
|
|
Reference in a new issue