-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
csv2json arguments for changing default delimiter, quote & escape cha…
…racters
- Loading branch information
Showing
9 changed files
with
159 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
name = "convert2json" | ||
description = "CLI utilities to convert CSV, TOML, XML & YAML into JSON and for use with jq." | ||
authors = ["Simon Rupf <[email protected]>"] | ||
version = "0.3.0" | ||
version = "0.4.0" | ||
edition = "2021" | ||
license = "MIT" | ||
repository = "https://github.com/simonrupf/convert2json" | ||
|
@@ -29,6 +29,7 @@ yaml2json = [] | |
yq = [] | ||
|
||
[dependencies] | ||
argh = "0.1.10" | ||
csv = "1.2.2" | ||
is-terminal = "0.4.7" | ||
serde = { version = "1.0.164", features = ["serde_derive"] } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
accepted = [ | ||
"Apache-2.0", | ||
"BSD-3-Clause", | ||
"MIT", | ||
"Unicode-DFS-2016", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
use convert2json::csv::{append, CsvMap}; | ||
use convert2json::csv::{CsvMap, CsvReader}; | ||
use convert2json::jq::{parse_args, readers, Jq}; | ||
|
||
#[cfg(feature = "cq")] | ||
fn main() { | ||
let (arguments, files) = parse_args(); | ||
let mut jq = Jq::new(&arguments); | ||
let mut csv: CsvReader = Default::default(); | ||
let mut results: Vec<CsvMap> = vec![]; | ||
for reader in readers(&files) { | ||
append(&mut results, reader); | ||
csv.append(&mut results, reader); | ||
} | ||
jq.write(&results); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
use convert2json::csv::{append, CsvMap}; | ||
use convert2json::csv::{CsvMap, CsvReader}; | ||
use convert2json::json::{parse_args, stdout_writer}; | ||
|
||
#[cfg(feature = "csv2json")] | ||
fn main() { | ||
let mut csv = CsvReader::new(); | ||
let mut results: Vec<CsvMap> = vec![]; | ||
for reader in parse_args() { | ||
append(&mut results, reader); | ||
csv.append(&mut results, reader); | ||
} | ||
stdout_writer(&results); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters