I have a couple of Bike outlines here in which I have been highlighting terms of interest, and now I want to list those terms.
We can start by filtering in the Bike app GUI (⇧⌘F) with an outline path:
//*/run::@mark/..
Also, the new bike command line (Bike > Install Command Line Tool ...) can harvest matching lines as text, markdown, json, bike, or opml
Lets start with text:
bike get outline --refs '//*/run::@mark/..' -o txt
If we only want the highlit words themselves, without the line containing them, then we can first switch to json (the default, so we don’t need the -o switch now)
bike get outline --refs '//*/run::@mark/..'
and then pipe the result into a jq query (jqlang can be installed via brew)
which pulls out just the highlit strings themselves:
.root.children[].text[] | select(.attrs.mark).string
Putting it together for the command line, specifying -r for text output without double quotes:
bike get outline --refs '//*/run::@mark/..' | jq -r '.root.children[].text[] | select(.attrs.mark).string'