File tree Expand file tree Collapse file tree 1 file changed +21
-14
lines changed Expand file tree Collapse file tree 1 file changed +21
-14
lines changed Original file line number Diff line number Diff line change @@ -612,20 +612,27 @@ impl<'a> TryFrom<rusqlite::types::ValueRef<'a>> for Nullable<&'a str> {
612
612
async fn main ( ) -> anyhow:: Result < ( ) > {
613
613
env_logger:: init ( ) ;
614
614
615
- let mut args = std:: env:: args ( ) ;
616
- let executable = args. next ( ) . unwrap ( ) ;
617
-
618
- if args. len ( ) != 2 {
619
- eprintln ! (
620
- "Usage: {0} <sqlite-db> <postgres-db>\n \
621
- E.g.: {0} results.db postgres://user:password@localhost:5432",
622
- executable,
623
- ) ;
624
- std:: process:: exit ( 1 ) ;
625
- }
626
-
627
- let sqlite = args. next ( ) . unwrap ( ) ;
628
- let postgres = args. next ( ) . unwrap ( ) ;
615
+ let matches = clap:: App :: new ( "sqlite-to-postgres" )
616
+ . about ( "Exports a rustc-perf SQLite database to a Postgres database" )
617
+ . arg (
618
+ clap:: Arg :: with_name ( "sqlite-db" )
619
+ . required ( true )
620
+ . value_name ( "SQLITE_DB" )
621
+ . help ( "SQLite database file" ) ,
622
+ )
623
+ . arg (
624
+ clap:: Arg :: with_name ( "postgres-db" )
625
+ . required ( true )
626
+ . value_name ( "POSTGRES_DB" )
627
+ . help (
628
+ "Postgres database connection string, \
629
+ e.g. postgres://user:password@localhost:5432",
630
+ ) ,
631
+ )
632
+ . get_matches ( ) ;
633
+
634
+ let postgres = matches. value_of ( "postgres-db" ) . unwrap ( ) ;
635
+ let sqlite = matches. value_of ( "sqlite-db" ) . unwrap ( ) ;
629
636
630
637
let mut sqlite = sqlite:: Sqlite :: new ( sqlite. into ( ) )
631
638
. open ( )
You can’t perform that action at this time.
0 commit comments