From 891855452a18472f103421787e8c5893dd89bffe Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 28 Feb 2019 16:02:20 +0000 Subject: [PATCH] better parsing, can cope with { } things --- fucking-cargo | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fucking-cargo b/fucking-cargo index 1a92c37..2250cd9 100755 --- a/fucking-cargo +++ b/fucking-cargo @@ -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+='} ' -- 2.30.2