Merge branch 'feature-script-add-function' into develop

This commit is contained in:
6543 2018-05-20 21:17:07 +02:00
commit 832decf3d1
2 changed files with 17 additions and 3 deletions

View File

@ -2,10 +2,12 @@
#remaster lib
[ -d "<LIBDIR>" ] || { echo "LIBDIR not exist"; exit 1; }

#beginn func

#<function> [param]
function <function>() {
#Code of <function>
}

#this func is standalone executable
[ -n "$1" ] && {
check_user
<function> $@
}

12
script/add_function.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash

#check param
[ -z "$1" ] && { echo "$0 [name]"; exit 1; }
name="$1"

#gen function
cp "doc/lib-head+tail" "src/func/$name"
sed -i "s/<function>/$name/g" "src/func/$name"

#open
editor "src/func/$name"