[fix] Edit .scripts, bashrc, vimrc & other
[dotfiles_afify.git] / .scripts / git_init_c.sh
blob6fb82a32078362f8d31576c1c8810392540767fc
1 #!/usr/bin/env bash
3 #==============================================================================
4 # Name : git_init
5 # GitHub : HassanAfify
6 # Copyright : MIT
7 # Version : 0.1
8 # Description : Create a C project
9 # git init + 4 files (license, README, Makefile & .gitignore)
10 #==============================================================================
12 proj=$1
13 # proj=${PWD##*/}
14 Proj=${proj^}
15 year=`date +'%Y'`
17 mkdir $proj
18 cd $proj
20 # Create git repo
21 git init
23 # Add github
24 git remote add origin git@github.com:HassanAfify/$proj.git
25 echo "[] Git add upstream bransh."
28 # Create License
29 #==============================================================================
30 echo "MIT License
32 Copyright (c) $year Hassan Afify
34 Permission is hereby granted, free of charge, to any person obtaining a copy
35 of this software and associated documentation files (the "Software"), to deal
36 in the Software without restriction, including without limitation the rights
37 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
38 copies of the Software, and to permit persons to whom the Software is
39 furnished to do so, subject to the following conditions:
41 The above copyright notice and this permission notice shall be included in all
42 copies or substantial portions of the Software.
44 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
45 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
46 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
47 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
48 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
49 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
50 SOFTWARE." > ./LICENSE
51 echo "[] Create License File."
53 # Create Makefile
54 #==============================================================================
55 echo "# $Proj
56 # See LICENSE file for copyright and license details.
57 .POSIX:
59 SRC = $proj.c
60 CC = gcc
61 TARGET= $proj
62 IFLAGS= /usr/local/include/
63 LDFLAGS= /usr/local/lib
64 WARN= -Wall -Wextra -pedantic
66 all:
67 \$(CC) \$(SRC) -o \$(TARGET) -I \$(IFLAGS) -L \$(LDFLAGS) \$(WARN)
69 clean:
70 rm \$(TARGET)
72 test:
73 splint \$(SRC) > security.log
75 install: $proj
76 mkdir -p /bin
77 cp -f $proj /bin
78 chmod 755 /bin/$proj" > ./Makefile
79 echo "[] Create Make File."
81 # Create gitignore
82 #==============================================================================
84 echo "*.db
85 *.txt
86 *.log
87 .DS_Store" > ./.gitignore
88 echo "[] Create gitignore File."
90 # Create Readme
91 #==============================================================================
93 echo "# $Proj
94 [![platform](https://img.shields.io/badge/Platform-Linux-blue.svg)](#)
95 [![license](https://img.shields.io/github/license/HassanAfify/$proj.svg)](https://github.com/HassanAfify/$proj/blob/master/LICENSE)
97 #### Build
98 ---
99 \`\`\`sh
100 $ git clone https://github.com/HassanAfify/$proj.git
101 $ cd $proj
102 $ make
103 $ sudo make clean install
104 \`\`\`
105 #### Run
107 \`\`\`sh
108 $ $proj
109 \`\`\`
110 #### Ask Questions
112 You are welcome to submit questions and bug reports as Github Issues.
114 #### Copyright and License
116 $Proj is provided under the MIT license." > ./README
117 echo "[] Create Readme File."