brew install htmlq
Use Case 1:
<div id="button"><a href="http://google.com">Test Google</a></div>
Usage 1:
echo "<div id="button"><a href="http://google.com">Test Google</a></div>" | htmlq --attribute href a
Result :
http://google.com
- https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors
- https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Selectors
brew install yq
Use Case 1:
Set runtime environment variables on a scheme in Xcode
Usage 1:
XCSCHEME_PATH=.swiftpm/xcode/xcshareddata/xcschemes/$1.xcscheme
XML_PATH=.swiftpm/xcode/xcshareddata/xcschemes/generatedXML.xml
yq '.Scheme.LaunchAction.EnvironmentVariables.EnvironmentVariable |= [{"+key" : "DEBUG_LOG", "+value": "", "+isEnabled": "YES"}]' "$XCSCHEME_PATH" -p=xml -o=xml > $XML_PATH && rm "$XCSCHEME_PATH" && mv $XML_PATH "$XCSCHEME_PATH"
brew install jq
Use Case 1:
[{"name":"foo"},{"name":"bar"}]
Usage 1:
echo '[{"name":"foo"},{"name":"bar"}]' | jq -c '.[].name'
Result :
"foo"
"bar