Attributes for |
110 | -h, --help Print help
111 | -V, --version Print version
112 | ```
113 |
114 | ## Use examples
115 |
116 | This command reads data from `test/test.csv` and writes an HTML table to `test.html`:
117 |
118 | ```sh
119 | csv2html -o test.html tests/test.csv
120 | ```
121 |
122 | The following command takes semicolon-delimited data from `pub.csv`, starting with row 267.
123 | It replaces the first column of the table with the row number starting at 1 (except in the header row, which is not changed).
124 | The output is redirected to the file `pub.html`.
125 |
126 | ```sh
127 | csv2html pub.csv -d \; -r -s 267 > pub.html
128 | ```
129 |
130 | The same as above, but the output is a full HTML document instead of just the markup for the table:
131 |
132 | ```sh
133 | csv2html pub.csv -d \; -r -s 267 -c > pub.html
134 | ```
135 |
136 | If the input file is tab-delimited, use `\t` as the deliminter argument.
137 |
138 | ```sh
139 | # POSIX.
140 | csv2html --delimiter '\t' tests/test.tsv
141 | ```
142 |
143 | ```batch
144 | rem Windows.
145 | csv2html-win32.exe --delimiter \t tests/test.tsv
146 | ```
147 |
148 | `\t` is the only [backslash escape sequence](https://en.wikipedia.org/wiki/Escape_sequences_in_C) that is implemented.
149 |
150 | ## License
151 |
152 | Three-clause ("new" or "revised") BSD.
153 | See the file `LICENSE`.
154 |
--------------------------------------------------------------------------------
/tests/e2e.rs:
--------------------------------------------------------------------------------
1 | // End-to-end tests for csv2html.
2 | // Copyright (c) 2013-2014, 2017, 2020, 2021, 2024-2025 D. Bohdan.
3 | // License: BSD (3-clause). See the file LICENSE.
4 |
5 | use std::{
6 | convert::AsRef,
7 | env,
8 | ffi::OsStr,
9 | fs,
10 | io::{Result, Write},
11 | iter::IntoIterator,
12 | process::{Command, Stdio},
13 | };
14 | use {exitcode, regex::Regex};
15 |
16 | #[derive(Debug, Eq, PartialEq)]
17 | struct Output {
18 | code: i32,
19 | stderr: String,
20 | stdout: String,
21 | }
22 |
23 | fn csv2html_cmd() -> String {
24 | env::var("CSV2HTML_COMMAND")
25 | .expect("Environment variable CSV2HTML_COMMAND should be set")
26 | }
27 |
28 | fn csv2html(args: I) -> Result |