@@ -121,7 +121,7 @@ enum Commands {
121121 Doctor ,
122122 /// Reset the ontology environment by removing the .ontoenv directory
123123 Reset {
124- #[ clap( long, short, action = clap:: ArgAction :: Set , default_value = "false" ) ]
124+ #[ clap( long, short, action = clap:: ArgAction :: SetTrue , default_value = "false" ) ]
125125 force : bool ,
126126 } ,
127127}
@@ -171,7 +171,11 @@ fn main() -> Result<()> {
171171 if cmd. verbose || cmd. debug {
172172 config. print ( ) ;
173173 }
174- let ontoenv_exists = current_dir ( ) ?. join ( ".ontoenv" ) . exists ( ) ;
174+ let ontoenv_exists = current_dir ( ) ?
175+ . join ( ".ontoenv" )
176+ . join ( "ontoenv.json" )
177+ . exists ( ) ;
178+ println ! ( "[INFO] OntoEnv exists: {}" , ontoenv_exists) ;
175179
176180 // create the env object to use in the subcommand.
177181 // - if temporary is true, create a new env object each time
@@ -181,12 +185,13 @@ fn main() -> Result<()> {
181185 let mut e = OntoEnv :: init ( config. clone ( ) , false ) ?;
182186 e. update ( ) ?;
183187 Some ( e)
184- } else if cmd. command . to_string ( ) != "Init" && ontoenv_exists{
188+ } else if cmd. command . to_string ( ) != "Init" && ontoenv_exists {
185189 // if .ontoenv exists, load it
186190 Some ( OntoEnv :: load_from_directory ( current_dir ( ) ?, false ) ?) // no read-only
187191 } else {
188192 None
189193 } ;
194+ println ! ( "[INFO] OntoEnv loaded: {}" , env. is_some( ) ) ;
190195
191196 match cmd. command {
192197 Commands :: Init {
@@ -342,7 +347,7 @@ fn main() -> Result<()> {
342347 // remove .ontoenv directory
343348 let path = current_dir ( ) ?. join ( ".ontoenv" ) ;
344349 println ! ( "Removing .ontoenv directory at {}..." , path. display( ) ) ;
345- if path . exists ( ) && !force {
350+ if !force {
346351 // check delete? [y/N]
347352 let mut input = String :: new ( ) ;
348353 println ! ( "Are you sure you want to delete the .ontoenv directory? [y/N] " ) ;
@@ -354,6 +359,8 @@ fn main() -> Result<()> {
354359 println ! ( "Aborting..." ) ;
355360 return Ok ( ( ) ) ;
356361 }
362+ }
363+ if path. exists ( ) {
357364 std:: fs:: remove_dir_all ( path) ?;
358365 }
359366 }
0 commit comments