remove template system
This commit is contained in:
50
bin/yait
50
bin/yait
@@ -12,16 +12,6 @@ scriptversion="1"
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
strip_comments() {
|
||||
for file in "$@"; do
|
||||
if [ ! -f "$file" ]; then
|
||||
echo "Error: File '$file' does not exist." >&2
|
||||
return 1
|
||||
fi
|
||||
sed 's/^[[:space:]]*;.*//; /^[[:space:]]*$/d' "$file"
|
||||
done
|
||||
}
|
||||
|
||||
me=$0
|
||||
version="$me v$scriptversion
|
||||
|
||||
@@ -40,25 +30,39 @@ Options:
|
||||
-x <language> set project type
|
||||
-S small project creation
|
||||
-f overwrite existing files
|
||||
-n <name> set project name
|
||||
-a <author> set project author
|
||||
-r initialize Git repository for the project
|
||||
-q surpress output"
|
||||
|
||||
x="C"
|
||||
S=
|
||||
f=
|
||||
n=
|
||||
a=$(git config user.name)
|
||||
r=
|
||||
q=
|
||||
x=C # language
|
||||
S= # small project creation (bool)
|
||||
f= # force (bool)
|
||||
a=$(git config user.name) # author
|
||||
r= # initialize repository (bool)
|
||||
q= # surpress output
|
||||
|
||||
mfmt() {
|
||||
format() {
|
||||
if [ -z "$q" ]; then
|
||||
echo "$me: $*"
|
||||
fi
|
||||
}
|
||||
|
||||
create_project() {
|
||||
name=$1
|
||||
|
||||
if ! echo "$name" | grep -qE '^[A-Za-z0-9_-]+$'; then
|
||||
format "invalid name '$name'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "invoke"
|
||||
}
|
||||
|
||||
if ! [ $# -gt 0 ]; then
|
||||
echo "$usage"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
--help) echo "$usage"; exit 0 ;;
|
||||
@@ -66,16 +70,10 @@ while [ $# -gt 0 ]; do
|
||||
-x) shift; x=$1; break ;;
|
||||
-S) S=true; break ;;
|
||||
-f) f=true; break ;;
|
||||
-n) shift; n=$1; break ;;
|
||||
-a) shift; a=$1; break ;;
|
||||
-r) r=true; break ;;
|
||||
-q) q=true; break ;;
|
||||
-*) echo "$me: Unknown option '$1'." >&2; exit 1 ;;
|
||||
*) break ;;
|
||||
*) create_project $1; shift ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if ! [ $# -gt 0 ]; then
|
||||
echo "$usage"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user