fix scripts
This commit is contained in:
@@ -8,6 +8,5 @@ members = [
|
|||||||
"loops",
|
"loops",
|
||||||
"ownership",
|
"ownership",
|
||||||
"references_and_borrowing",
|
"references_and_borrowing",
|
||||||
"slice_type",
|
|
||||||
"variables",
|
"variables",
|
||||||
]
|
]
|
||||||
|
@@ -12,25 +12,5 @@ fi
|
|||||||
# Step 1: Create new cargo project without Git
|
# Step 1: Create new cargo project without Git
|
||||||
cargo new "$name" --vcs none
|
cargo new "$name" --vcs none
|
||||||
|
|
||||||
# Step 2: Insert project into workspace Cargo.toml
|
|
||||||
if grep -q "^\[workspace\]" Cargo.toml; then
|
|
||||||
if grep -q "\"$name\"" Cargo.toml; then
|
|
||||||
echo "⚠️ Project '$name' already exists in workspace members. Skipping insertion."
|
|
||||||
else
|
|
||||||
echo "📦 Adding '$name' to workspace members..."
|
|
||||||
|
|
||||||
# Find the line number of the closing bracket ]
|
|
||||||
end_line=$(awk '/members\s*=\s*\[/,/\]/{if ($0 ~ /\]/) print NR}' Cargo.toml)
|
|
||||||
|
|
||||||
# Insert before the closing bracket
|
|
||||||
awk -v name="$name" -v end="$end_line" '
|
|
||||||
NR == end { print " \"" name "\"," }
|
|
||||||
{ print }
|
|
||||||
' Cargo.toml > Cargo.toml.tmp && mv Cargo.toml.tmp Cargo.toml
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "❌ No [workspace] section found in Cargo.toml."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "✅ Project '$name' created and added to workspace!"
|
echo "✅ Project '$name' created and added to workspace!"
|
||||||
|
echo "add $name to Cargo.toml"
|
||||||
|
Reference in New Issue
Block a user