From d12125737b9068a653124c21cfc66b67c4b7704b Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 20 Mar 2022 01:54:48 +0100 Subject: main: Add an option to include the primary key in output Since the primary key column is excluded by default, there's no way to include it without excluding columns. Provide a way to include the primary key column when no columns have been excluded. Not a very good interface admittedly, but it enables a previously impossible behaviour. --- src/main.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main.rs b/src/main.rs index 1d918d0..9a82d25 100644 --- a/src/main.rs +++ b/src/main.rs @@ -33,6 +33,9 @@ enum Command { #[clap(long)] exclude_column: Option>, + + #[clap(long)] + include_primary_key: bool, }, } @@ -75,8 +78,13 @@ fn main() { table_name, primary_key, record_id, - exclude_column, + mut exclude_column, + include_primary_key, } => { + if exclude_column.is_none() && include_primary_key { + exclude_column = Some(Vec::new()); + } + let dbconn = rusqlite::Connection::open(database).unwrap(); let yaml_data = match primary_key { -- cgit v1.2.3