-
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.
* add alternate delimiter * fix test
- Loading branch information
Showing
5 changed files
with
30 additions
and
6 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
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 |
---|---|---|
|
@@ -7,18 +7,24 @@ use crate::qsv::{execute_query, write_to_stdout}; | |
use std::error::Error; | ||
use simple_logger::SimpleLogger; | ||
use clap::{AppSettings, Clap}; | ||
use crate::qsv::Options; | ||
|
||
#[derive(Clap)] | ||
#[clap(version = "0.1", author = "Dermot H. <[email protected]>")] | ||
#[clap(setting = AppSettings::ColoredHelp)] | ||
struct Opts { | ||
query: String, | ||
#[clap(short, long, default_value=",")] | ||
delimiter: char | ||
} | ||
|
||
fn main() -> Result<(), Box<dyn Error>> { | ||
SimpleLogger::from_env().init()?; | ||
let opts: Opts = Opts::parse(); | ||
let query = opts.query; | ||
let results = execute_query(query.as_str())?; | ||
let delimiter = opts.delimiter; | ||
let options = Options{delimiter}; | ||
let results = execute_query(query.as_str(), &options)?; | ||
write_to_stdout(results)?; | ||
Ok(()) | ||
} |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
occupation/minimum_age | ||
Bartender/32 | ||
Construction Worker/25 |
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