Skip to content
This repository has been archived by the owner on Nov 19, 2023. It is now read-only.

Commit

Permalink
Merge pull request #30 from eitsupi/prql-version
Browse files Browse the repository at this point in the history
feat: show PRQL version in about (in `--help` option)
  • Loading branch information
Tobias Brandt authored Mar 8, 2023
2 parents 230f09e + c9c042d commit a61aaa8
Show file tree
Hide file tree
Showing 5 changed files with 176 additions and 31 deletions.
193 changes: 169 additions & 24 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ atty = "0.2"
camino = "1.1.1"
cfg-if = "1.0.0"
chrono = "0.4"
clap = { version = "3.2.3", features = ["derive", "env"] }
clap = { version = "4.1.4", features = ["derive", "env", "string"] }
datafusion = { version = "12.0.0", optional = true, features = ["default", "avro"]}
dotenvy = "0.15.3"
duckdb = { version = "0.5.1", features = ["bundled", "modern-full"], optional = true }
Expand Down
2 changes: 1 addition & 1 deletion src/backends/datafusion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ fn write_record_batches_to_json(rbs: &[RecordBatch], dest: &mut dyn Write) -> Re
{
// let mut writer = json::ArrayWriter::new(&mut buf);
let mut writer = json::LineDelimitedWriter::new(dest);
writer.write_batches(&rbs)?;
writer.write_batches(rbs)?;
writer.finish()?;
}
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion src/backends/duckdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub fn query(
} else if source.ends_with(".parquet") {
format!("read_parquet('{source}')")
} else if database.starts_with("postgres") {
let mut parts: Vec<&str> = source.split(".").collect();
let mut parts: Vec<&str> = source.split('.').collect();
if parts.len() == 1 {
parts.insert(0, "public");
}
Expand Down
8 changes: 4 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use std::io::prelude::*;
use std::{fs, io};

use clap::{Parser, ValueEnum};
use prql_compiler::compile;
use prql_compiler::{compile, PRQL_VERSION};

cfg_if::cfg_if! {
if #[cfg(feature = "datafusion")] {
Expand All @@ -33,7 +33,7 @@ type SourcesType = Vec<(String, String)>;
#[clap(
name = env!("CARGO_PKG_NAME"),
version = env!("CARGO_PKG_VERSION"),
about = env!("CARGO_PKG_DESCRIPTION")
about = format!("{} version {} (https://prql-lang.org)", env!("CARGO_PKG_DESCRIPTION"), PRQL_VERSION.to_string())
)]
struct Cli {
/// The file(s) to read data FROM if given
Expand All @@ -57,14 +57,14 @@ struct Cli {
no_exec: bool,

/// The format to use for the output
#[clap(long, arg_enum, value_parser, env = "PQ_FORMAT")]
#[clap(long, value_enum, value_parser, env = "PQ_FORMAT")]
format: Option<OutputFormat>,

/// The Writer to use for writing the output
#[clap(
short,
long,
arg_enum,
value_enum,
value_parser,
default_value = "arrow",
env = "PQ_WRITER"
Expand Down

0 comments on commit a61aaa8

Please sign in to comment.