v2.3.0: project user config

This commit is contained in:
2025-11-09 21:45:10 +05:00
parent 49ccc76933
commit 05f3b9a0a0
6 changed files with 45 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env bash
INSTALLED_CBUILD_VERSION=2.2.4
INSTALLED_CBUILD_VERSION=2.3.0
# set \t size to 4 spaces
tabs 4
@@ -92,19 +92,23 @@ do
# create project config
project_config_path="$new_project_dir/project.config"
cp "$CBUILD_INSTALL_DIR/default.config" "$project_config_path.temp"
myprint "Enter project name: "
cp "$CBUILD_INSTALL_DIR/project.config.default" "$project_config_path.temp"
myprint "${WHITE}Enter project name: "
read -r project_name
sed "s,\%PROJECT_NAME\%,$project_name,g" \
"$project_config_path.temp" > "$project_config_path"
rm "$project_config_path.temp"
myprint "${GREEN}created config at '$project_config_path'"
myprint "${GREEN}Created '$project_config_path'"
# create project user default config
project_user_config_path="$new_project_dir/project.config.user.default"
cp "$CBUILD_INSTALL_DIR/project.config.user.default" "$project_user_config_path"
myprint "${GREEN}Created '$project_user_config_path'"
if ask_yn "Copy default .gitignore?"; then
if ask_yn "${WHITE}Copy default .gitignore?"; then
cp -v "$CBUILD_INSTALL_DIR/.gitignore" "$new_project_dir/"
fi
if ask_yn "Copy default .vscode launch tasks?"; then
if ask_yn "${WHITE}Copy default .vscode launch tasks?"; then
new_project_vscode_dir="$new_project_dir/.vscode"
mkdir -pv "$new_project_vscode_dir"
for vscode_dir_f in $(find "$CBUILD_INSTALL_DIR/default_vscode/" -type f); do
@@ -133,15 +137,17 @@ function call_task {
load_config "$project_config_path" "$task" true
if [ ! -z "$PRE_TASK_SCRIPT" ]; then
myprint "${BLUE}executing ${WHITE}$TASK_SCRIPT"
myprint "${BLUE}executing ${WHITE}'$PRE_TASK_SCRIPT'"
include "$PRE_TASK_SCRIPT"
fi
myprint "${BLUE}executing ${WHITE}$TASK_SCRIPT"
include "$TASK_SCRIPT"
if [ ! -z "$TASK_SCRIPT" ]; then
myprint "${BLUE}executing ${WHITE}'$TASK_SCRIPT'"
include "$TASK_SCRIPT"
fi
if [ ! -z "$POST_TASK_SCRIPT" ]; then
myprint "${BLUE}executing ${WHITE}$POST_TASK_SCRIPT"
myprint "${BLUE}executing ${WHITE}'$POST_TASK_SCRIPT'"
include "$POST_TASK_SCRIPT"
fi
}