diff options
author | Teddy Wing | 2022-03-20 01:54:48 +0100 |
---|---|---|
committer | Teddy Wing | 2022-03-20 01:54:48 +0100 |
commit | d12125737b9068a653124c21cfc66b67c4b7704b (patch) | |
tree | d79f4f07d11c4293fffe14e8e58ca858a3488f70 | |
parent | 09525eb8aae8801468a75b867361106f6f830e7c (diff) | |
download | yaqlite-d12125737b9068a653124c21cfc66b67c4b7704b.tar.bz2 |
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.
-rw-r--r-- | src/main.rs | 10 |
1 files changed, 9 insertions, 1 deletions
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<Vec<String>>, + + #[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 { |