diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-01-09 21:30:49 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-01-09 21:30:49 +0800 |
| commit | 6b9268d2d88c81c18f2cc21e343d321989dad99c (patch) | |
| tree | 051a3e1ca1c49a8e67a4da2c59fec576fc9e6ec5 /Collect-Command-Line.sh | |
| parent | 3f8e818b58127a2fad66ed67032344f553632c38 (diff) | |
Set up project structure and CLI integration
Diffstat (limited to 'Collect-Command-Line.sh')
| -rw-r--r-- | Collect-Command-Line.sh | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/Collect-Command-Line.sh b/Collect-Command-Line.sh new file mode 100644 index 0000000..61545b7 --- /dev/null +++ b/Collect-Command-Line.sh @@ -0,0 +1,53 @@ +# Get the absolute path of the directory where the current script is located +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +# Switch to the script's directory, exit if it fails +cd "$SCRIPT_DIR" || exit 1 + +# Define the target path for the CLI tool +cliPath=".Temp/Debug/JustEnoughVCS" + +# Check if the CLI already exists at the target path +if [ ! -f "$cliPath" ]; then + # Check if the CommandLine directory exists in the parent directory + if [ -d "./../CommandLine/" ]; then + # Check if a built CLI executable already exists + if [ -f "./../CommandLine/.temp/deploy/bin/jv" ]; then + # Create the target directory (if it doesn't exist) + mkdir -p "$(dirname "$cliPath")" + # Copy the CLI executable to the target path + cp "./../CommandLine/.temp/deploy/bin/jv" "$cliPath" + # Add execute permission + chmod +x "$cliPath" + echo "CLI copied to $cliPath" + else + # Check if a deployment script exists + if [ -f "./../CommandLine/deploy.sh" ]; then + echo "Building CLI from deploy.sh..." + # Enter the CommandLine directory and execute the deployment script + (cd "./../CommandLine" && ./deploy.sh) + # Check if the CLI executable was generated after deployment + if [ -f "./../CommandLine/.temp/deploy/bin/jv" ]; then + # Create the target directory (if it doesn't exist) + mkdir -p "$(dirname "$cliPath")" + # Copy the newly built CLI executable + cp "./../CommandLine/.temp/deploy/bin/jv" "$cliPath" + # Add execute permission + chmod +x "$cliPath" + echo "CLI built and copied to $cliPath" + else + # CLI executable still not found after deployment, error and exit + echo "Error: ./../CommandLine/.temp/deploy/bin/jv Not Found after deployment!" + exit 1 + fi + else + # Deployment script not found, error and exit + echo "Error: ./../CommandLine/deploy.sh Not Found!" + exit 1 + fi + fi + else + # CommandLine directory not found, error and exit + echo "Error: ./../CommandLine/ Not Found!" + exit 1 + fi +fi |
