Skip to content

Commit 1361c8c

Browse files
committed
Update README and bump version
1 parent 00a25d3 commit 1361c8c

File tree

4 files changed

+52
-9
lines changed

4 files changed

+52
-9
lines changed

Cargo.lock

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ documentation = "https://github.com/mgdm/htmlq/blob/master/README.md"
88
readme = "README.md"
99
license = "MIT"
1010
license-file = "LICENSE.md"
11-
version = "0.3.0"
11+
version = "0.4.0"
1212
authors = ["Michael Maclean <[email protected]>"]
1313
edition = "2018"
1414
exclude = ["/.github"]

README.md

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ brew install htmlq
1919

2020
```console
2121
$ htmlq -h
22-
htmlq 0.3.0
22+
htmlq 0.4.0
2323
Michael Maclean <[email protected]>
2424
Runs CSS selectors on HTML
2525

2626
USAGE:
27-
htmlq [FLAGS] [OPTIONS] [selector]...
27+
htmlq [FLAGS] [OPTIONS] [--] [selector]...
2828

2929
FLAGS:
3030
-B, --detect-base Try to detect the base URL from the <base> tag in the document. If not found, default to
@@ -36,10 +36,12 @@ FLAGS:
3636
-V, --version Prints version information
3737

3838
OPTIONS:
39-
-a, --attribute <attribute> Only return this attribute (if present) from selected elements
40-
-b, --base <base> Use this URL as the base for links
41-
-f, --filename <FILE> The input file. Defaults to stdin
42-
-o, --output <FILE> The output file. Defaults to stdout
39+
-a, --attribute <attribute> Only return this attribute (if present) from selected elements
40+
-b, --base <base> Use this URL as the base for links
41+
-f, --filename <FILE> The input file. Defaults to stdin
42+
-o, --output <FILE> The output file. Defaults to stdout
43+
-r, --remove-nodes <SELECTOR>... Remove nodes matching this expression before output. May be specified multiple
44+
times
4345

4446
ARGS:
4547
<selector>... The CSS expression to select [default: html]
@@ -107,6 +109,44 @@ to change that. NixOS has many innovative features:
107109
[...]
108110
```
109111

112+
### Remove a node before output
113+
114+
There's a big SVG image in this page that I don't need, so here's how to remove it.
115+
116+
```console
117+
$ curl --silent https://nixos.org/ | ./target/debug/htmlq '.whynix' --remove-nodes svg
118+
<ul class="whynix">
119+
<li>
120+
121+
<h2>Reproducible</h2>
122+
<p>
123+
Nix builds packages in isolation from each other. This ensures that they
124+
are reproducible and don't have undeclared dependencies, so <strong>if a
125+
package works on one machine, it will also work on another</strong>.
126+
</p>
127+
</li>
128+
<li>
129+
130+
<h2>Declarative</h2>
131+
<p>
132+
Nix makes it <strong>trivial to share development and build
133+
environments</strong> for your projects, regardless of what programming
134+
languages and tools you’re using.
135+
</p>
136+
</li>
137+
<li>
138+
139+
<h2>Reliable</h2>
140+
<p>
141+
Nix ensures that installing or upgrading one package <strong>cannot
142+
break other packages</strong>. It allows you to <strong>roll back to
143+
previous versions</strong>, and ensures that no package is in an
144+
inconsistent state during an upgrade.
145+
</p>
146+
</li>
147+
</ul>
148+
```
149+
110150
### Pretty print HTML
111151

112152
(This is a bit of a work in progress)

src/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ fn serialize_text(node: &NodeRef, ignore_whitespace: bool) -> String {
113113

114114
fn get_config<'a, 'b>() -> App<'a, 'b> {
115115
App::new("htmlq")
116-
.version("0.3.0")
116+
.version("0.4.0")
117117
.author("Michael Maclean <[email protected]>")
118118
.about("Runs CSS selectors on HTML")
119119
.arg(
@@ -177,6 +177,7 @@ fn get_config<'a, 'b>() -> App<'a, 'b> {
177177
.multiple(true)
178178
.number_of_values(1)
179179
.takes_value(true)
180+
.value_name("SELECTOR")
180181
.help("Remove nodes matching this expression before output. May be specified multiple times")
181182
)
182183
.arg(

0 commit comments

Comments
 (0)