<title>feat(tools/magrathea): add weirdly overengineered target spec parser</title>
<updated>2021-12-17T20:48:35+00:00</updated>
<author>
<name>Vincent Ambo</name>
<email>mail@tazj.in</email>
...</author>
<published>2021-12-17T18:17:28+00:00</published>
<link rel="alternate" type="text/html" href="http://code.tvl.fyi/commit/?id=cecc249c961735c9a9bd0c8d60e5fec7e4ac3b70"/>
<id>urn:sha1:cecc249c961735c9a9bd0c8d60e5fec7e4ac3b70</id>
<content type="text">
i'm not sure what happened here, but it works (yes, the fancy target
printing is completely unnecessary, but oh well):
#;152> (parse-target "foo")
#target(foo)
#;153> (parse-target "//foo")
#target(//foo)
#;154> (parse-target "//foo/bar")
#target(//foo/bar)
#;155> (parse-target "//foo/bar/")
#target(//foo/bar)
#;156> (parse-target "//foo/bar:baz")
#target(//foo/bar:baz)
#;157> (parse-target "//foo/bar/:baz")
#target(//foo/bar:baz)
#;158> (parse-target "//foo/bar:")
(error . "unexpected end of input while parsing virtual target")
#;159> (parse-target "//foo//")
(error . "unexpected root-anchor while parsing normal target")
the most notable thing is that trailing slashes are allowed in the
physical targets, since people may be autocompleting these on the
shell from folder names.
Change-Id: I32975ad77fe2a327130dc9574011fe92cce49f84
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4393
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
Reviewed-by: wpcarro <wpcarro@gmail.com>
</content>