2
0
mirror of https://github.com/chubin/cheat.sheets synced 2024-11-15 06:12:59 +00:00
cheat.sheets/sheets/pup

21 lines
501 B
Plaintext
Raw Normal View History

2017-06-07 09:54:00 +00:00
# pup
#
2020-10-20 22:26:55 +00:00
# Command line too for processing HTML
# Reading from stdin, pup prints to stdout, allowing the user to filter parts
# of the page using CSS selectors.
2017-06-07 09:54:00 +00:00
2020-10-20 22:26:55 +00:00
# Install pup. Requires `go`.
2017-06-07 09:54:00 +00:00
go install github.com/ericchiang/pup
2020-10-20 22:26:55 +00:00
# Indent and colorize HTML.
2017-06-07 09:54:00 +00:00
cat file.html | pup --color
2020-10-20 22:26:55 +00:00
# Filter by tag.
2017-06-07 09:54:00 +00:00
cat file.html | pup 'title'
2020-10-20 22:26:55 +00:00
# Pseudoclass: filter by content "History".
2017-06-07 09:54:00 +00:00
cat file.html | pup ':contains("History")'
2020-10-20 22:26:55 +00:00
# Multiple groups of selectors.
2017-06-07 09:54:00 +00:00
cat file.html | pup 'title, h1 span[dir="auto"]'