chore: --text usage
							parent
							
								
									1589f2f395
								
							
						
					
					
						commit
						b94a21cb2e
					
				
							
								
								
									
										39
									
								
								README.md
								
								
								
								
							
							
						
						
									
										39
									
								
								README.md
								
								
								
								
							| 
						 | 
					@ -41,15 +41,22 @@ Supported combinators are all the "basic" ones:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Usage
 | 
					## Usage
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```
 | 
					Once compiled, you can run Htmlq using the following command:
 | 
				
			||||||
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
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  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
 | 
					## 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.
 | 
					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
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										1
									
								
								main.lua
								
								
								
								
							
							
						
						
									
										1
									
								
								main.lua
								
								
								
								
							| 
						 | 
					@ -23,6 +23,7 @@ local function print_usage()
 | 
				
			||||||
		logger.print("  Flags:")
 | 
							logger.print("  Flags:")
 | 
				
			||||||
    logger.print("  -1, --first-only: return only the first match")
 | 
					    logger.print("  -1, --first-only: return only the first match")
 | 
				
			||||||
    logger.print("  -q, --quiet: Don't print warnings")
 | 
					    logger.print("  -q, --quiet: Don't print warnings")
 | 
				
			||||||
 | 
					    logger.print("  -t, --text: Print only the innerText of the matched elements")
 | 
				
			||||||
    os.exit(1)
 | 
					    os.exit(1)
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue