File tree 3 files changed +15
-3
lines changed
3 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -13,9 +13,12 @@ enum Cli {
13
13
14
14
#[ tokio:: main]
15
15
async fn main ( ) {
16
- dotenvy:: dotenv ( ) . ok ( ) ;
17
16
let Cli :: Sqlx ( opt) = Cli :: parse ( ) ;
18
17
18
+ if !opt. no_dotenv {
19
+ dotenvy:: dotenv ( ) . ok ( ) ;
20
+ }
21
+
19
22
if let Err ( error) = sqlx_cli:: run ( opt) . await {
20
23
println ! ( "{} {}" , style( "error:" ) . bold( ) . red( ) , error) ;
21
24
process:: exit ( 1 ) ;
Original file line number Diff line number Diff line change @@ -4,9 +4,14 @@ use sqlx_cli::Opt;
4
4
5
5
#[ tokio:: main]
6
6
async fn main ( ) {
7
- dotenvy:: dotenv ( ) . ok ( ) ;
7
+ let opt = Opt :: parse ( ) ;
8
+
9
+ if !opt. no_dotenv {
10
+ dotenvy:: dotenv ( ) . ok ( ) ;
11
+ }
12
+
8
13
// no special handling here
9
- if let Err ( error) = sqlx_cli:: run ( Opt :: parse ( ) ) . await {
14
+ if let Err ( error) = sqlx_cli:: run ( opt ) . await {
10
15
println ! ( "{} {}" , style( "error:" ) . bold( ) . red( ) , error) ;
11
16
std:: process:: exit ( 1 ) ;
12
17
}
Original file line number Diff line number Diff line change @@ -7,6 +7,10 @@ use clap_complete::Shell;
7
7
#[ derive( Parser , Debug ) ]
8
8
#[ clap( version, about, author) ]
9
9
pub struct Opt {
10
+ /// Do not automatically load `.env` files.
11
+ #[ clap( long) ]
12
+ pub no_dotenv : bool ,
13
+
10
14
#[ clap( subcommand) ]
11
15
pub command : Command ,
12
16
}
You can’t perform that action at this time.
0 commit comments