cosmetics on rfc.sh
* more elegant CamelCasing function * use less -F for presenting the usage/help * make 'smart_wrap' useable for standalone reformatting
This commit is contained in:
parent
5de0c1e6b7
commit
560394b2e6
1 changed files with 6 additions and 11 deletions
17
admin/rfc.sh
17
admin/rfc.sh
|
|
@ -4,7 +4,7 @@ shopt -s extglob
|
|||
|
||||
function usage()
|
||||
{
|
||||
less -e <<"EOF"
|
||||
less -F <<"EOF"
|
||||
Script to maintain Lumiera RFC's
|
||||
|
||||
usage:
|
||||
|
|
@ -67,16 +67,7 @@ EOF
|
|||
|
||||
function camel_case()
|
||||
{
|
||||
local c
|
||||
local u
|
||||
local t=" $1"
|
||||
|
||||
for c in {a..z}; do
|
||||
u=$(tr "a-z" "A-Z" <<<"$c")
|
||||
t="${t// $c/$u}"
|
||||
done
|
||||
|
||||
echo "$(tr -c -d "A-Za-z" <<<"$t")"
|
||||
sed -e 's/[^[:alnum:]]/ /g;s/ \+\(.\)/\U\1/g' <<<" $1"
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -418,6 +409,10 @@ wrap)
|
|||
smart_wrap "$file" 80
|
||||
done
|
||||
;;
|
||||
smart_wrap)
|
||||
# multipurpose smart wrap
|
||||
smart_wrap "$1" ${2:-80}
|
||||
;;
|
||||
help|*)
|
||||
usage
|
||||
;;
|
||||
|
|
|
|||
Loading…
Reference in a new issue