add project initialization feature
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
f1d8002072
commit
acb985eb42
44
linac
44
linac
|
@ -44,6 +44,50 @@ BuildProject() {
|
|||
done > "${config[build_path]}$1.sh"
|
||||
AddShebang "$1"
|
||||
}
|
||||
InitProject() {
|
||||
available_licenses=('' 'GPLv3' 'Apache License 2.0' 'MIT')
|
||||
|
||||
GetInitInfo() {
|
||||
while [[ -z "$init_name" ]]; do
|
||||
read -r -p "$(echo -e '\nWhat is the project'\''s name? ')" init_name
|
||||
done
|
||||
read -r -p "$(echo -e '\nPlease enter a description for the project. ')" init_description
|
||||
read -r -p "$(echo -e '\nWho is the project'\''s author? ')" init_author
|
||||
echo -e '\nPlease select a license for the project:\n'
|
||||
for ((i=1;i<"${#available_licenses[*]}";i++)); do
|
||||
echo -e " [$i] ${available_licenses[$i]}"
|
||||
done
|
||||
read -r -p "" init_license_num
|
||||
init_license=${available_licenses[$init_license_num]}
|
||||
|
||||
WriteInitInfo
|
||||
}
|
||||
|
||||
WriteInitInfo() {
|
||||
echo -e "projectName=$init_name" > "$init_name.info"
|
||||
{
|
||||
echo -e "projectDescription=$init_description"
|
||||
echo -e "projectAuthor=$init_author"
|
||||
echo -e "projectLicense=$init_license"
|
||||
} >> "$init_name.info"
|
||||
|
||||
echo -e "# Add build files to this file. One per line." > "$init_name.build"
|
||||
}
|
||||
|
||||
if [[ -f "linac.conf" ]]; then
|
||||
read -r -p "$(echo -e 'It looks like there is already another LINAC project in this directory! Are you sure you want to initialize a new project? (Y/n) ')" init_confirm
|
||||
case "$init_confirm" in
|
||||
[yY]|[Yy][Ee][Ss] ) GetInitInfo;;
|
||||
[Nn]|[Nn][Oo] ) exit 0;;
|
||||
* ) exit 0;;
|
||||
esac
|
||||
else
|
||||
GetInitInfo
|
||||
fi
|
||||
}
|
||||
SubInit() {
|
||||
InitProject
|
||||
}
|
||||
SubBuild() {
|
||||
BuildProject "$1"
|
||||
}
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
InitProject() {
|
||||
available_licenses=('' 'GPLv3' 'Apache License 2.0' 'MIT')
|
||||
|
||||
GetInitInfo() {
|
||||
while [[ -z "$init_name" ]]; do
|
||||
read -r -p "$(echo -e '\nWhat is the project'\''s name? ')" init_name
|
||||
done
|
||||
read -r -p "$(echo -e '\nPlease enter a description for the project. ')" init_description
|
||||
read -r -p "$(echo -e '\nWho is the project'\''s author? ')" init_author
|
||||
echo -e '\nPlease select a license for the project:\n'
|
||||
for ((i=1;i<"${#available_licenses[*]}";i++)); do
|
||||
echo -e " [$i] ${available_licenses[$i]}"
|
||||
done
|
||||
read -r -p "" init_license_num
|
||||
init_license=${available_licenses[$init_license_num]}
|
||||
|
||||
WriteInitInfo
|
||||
}
|
||||
|
||||
WriteInitInfo() {
|
||||
echo -e "projectName=$init_name" > "$init_name.info"
|
||||
{
|
||||
echo -e "projectDescription=$init_description"
|
||||
echo -e "projectAuthor=$init_author"
|
||||
echo -e "projectLicense=$init_license"
|
||||
} >> "$init_name.info"
|
||||
|
||||
echo -e "# Add build files to this file. One per line." > "$init_name.build"
|
||||
}
|
||||
|
||||
if [[ -f "linac.conf" ]]; then
|
||||
read -r -p "$(echo -e 'It looks like there is already another LINAC project in this directory! Are you sure you want to initialize a new project? (Y/n) ')" init_confirm
|
||||
case "$init_confirm" in
|
||||
[yY]|[Yy][Ee][Ss] ) GetInitInfo;;
|
||||
[Nn]|[Nn][Oo] ) exit 0;;
|
||||
* ) exit 0;;
|
||||
esac
|
||||
else
|
||||
GetInitInfo
|
||||
fi
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
SubInit() {
|
||||
InitProject
|
||||
}
|
Loading…
Reference in New Issue