chore: --text usage

main
Guilian 2025-01-20 17:20:28 +01:00
parent 1589f2f395
commit b94a21cb2e
Signed by: Guilian
GPG Key ID: B86CC9678982ED8C
2 changed files with 15 additions and 25 deletions

View File

@ -41,15 +41,22 @@ Supported combinators are all the "basic" ones:
## Usage
```
Usage: lua main.lua [FLAGS] <html_path_or_minus> <css_selector>
html_path_or_minus: Path to HTML file or '-' for stdin
css_selector: CSS selector to search for
Once compiled, you can run Htmlq using the following command:
Flags:
-f, --first-only: return only the first match
-q, --quiet: Don't print warnings
```
./htmlq [FLAGS] <html_path_or_minus> <css_selector>
```
Where:
* `<html_path_or_minus>` is the path to the HTML file you want to parse, or `-` to read from stdin.
* `<css_selector>` is the CSS selector you want to use to query the HTML.
### Flags
* `-1`, `--first-only`: Return only the first match
* `-q`, `--quiet`: Don't print warnings
* `-t`, `--text`: Print only the [innerText](https://developer.mozilla.org/fr/docs/Web/API/HTMLElement/innerText) of the matched elements
## Motivation
@ -82,21 +89,3 @@ luastatic main.lua css.lua html.lua logging.lua /usr/lib/liblua5.4.so -o htmlq
```
Note that all `.lua` files from the project need to be specified, with `main.lua` as the first one. Also, the path to `liblua` may vary according to your system. The example provided is for an installation on EndeavourOS.
## Running
Once compiled, you can run Htmlq using the following command:
```
./htmlq [FLAGS] <html_path_or_minus> <css_selector>
```
Where:
* `<html_path_or_minus>` is the path to the HTML file you want to parse, or `-` to read from stdin.
* `<css_selector>` is the CSS selector you want to use to query the HTML.
### Flags
* `-f`, `--first-only`: Return only the first match
* `-q`, `--quiet`: Don't print warnings

View File

@ -23,6 +23,7 @@ local function print_usage()
logger.print(" Flags:")
logger.print(" -1, --first-only: return only the first match")
logger.print(" -q, --quiet: Don't print warnings")
logger.print(" -t, --text: Print only the innerText of the matched elements")
os.exit(1)
end