chiark / gitweb /
better parsing, can cope with { } things
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 28 Feb 2019 16:02:20 +0000 (16:02 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 28 Feb 2019 16:02:20 +0000 (16:02 +0000)
fucking-cargo

index 1a92c373ac6d483e7aa4586a6899ffaf401401b3..2250cd952368eb35fb26456fe66361a9c8b0842a 100755 (executable)
@@ -27,8 +27,12 @@ exec 204<../Fuck
 while read <&204 what where; do
        if [ "x$what" = x- ]; then continue; fi
        qwhere="${where//\//\\/}"
-       sed+=' s/^'$what' *=.*/'$what' = { path = "..\/'"${qwhere}"'" }/;
-'
+       sed+='
+               s/^'$what' *= *\(\".*\"\) *$/'$what' = { version = \1 }/;
+               s/^'$what' *= *{/'$what' = { path = "..\/'"${qwhere}"'", /;
+               /^'$what' *=/ s/version *= *\"[^"]*\"//;
+               /^'$what' *=/ s/, *\([,}]\)/\1/;
+       '
 done
 sed+='}
 '