File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -259,16 +259,17 @@ fn warn_if_legacy_toml_config(nuon_path: &Path) {
259259 let toml_path = nuon_path. with_extension ( "toml" ) ;
260260 if toml_path. exists ( ) {
261261 ui:: warn ( "config.toml detected but quiver now requires config.nuon. Migrate with:" ) ;
262- eprintln ! ( ) ;
263- eprintln ! (
262+ ui:: plain ( format ! (
264263 " open {} | to nuon --indent 2 | save -f {}" ,
265264 toml_path. display( ) ,
266265 nuon_path. display( )
267- ) ;
268- eprintln ! ( " rm {}" , toml_path. display( ) ) ;
269- eprintln ! ( " rm {}" , nuon_path. with_file_name( "config.lock" ) . display( ) ) ;
270- eprintln ! ( " qv install -g" ) ;
271- eprintln ! ( ) ;
266+ ) ) ;
267+ ui:: plain ( format ! ( " rm {}" , toml_path. display( ) ) ) ;
268+ ui:: plain ( format ! (
269+ " rm {}" ,
270+ nuon_path. with_file_name( "config.lock" ) . display( )
271+ ) ) ;
272+ ui:: plain ( " qv install -g" ) ;
272273 }
273274}
274275
Original file line number Diff line number Diff line change @@ -518,7 +518,7 @@ fn install_resolved_global(
518518 "To load quiver autoload files from {}, add this to config.nu:" ,
519519 global_autoload_dir_expression( )
520520 ) ) ;
521- ui:: info ( format ! ( " {}" , global_autoload_config_hint( ) ) ) ;
521+ ui:: plain ( format ! ( " {}" , global_autoload_config_hint( ) ) ) ;
522522 }
523523
524524 Ok ( ( ) )
Original file line number Diff line number Diff line change @@ -191,8 +191,17 @@ fn cmd_tui(cwd: &Path, global: bool) -> Result<()> {
191191}
192192
193193fn require_project_dir ( start : & Path ) -> Result < PathBuf > {
194- Manifest :: find_project_dir ( start)
195- . ok_or_else ( || error:: QuiverError :: NoManifest ( start. to_path_buf ( ) ) )
194+ if let Some ( dir) = Manifest :: find_project_dir ( start) {
195+ return Ok ( dir) ;
196+ }
197+ if let Some ( dir) = start
198+ . ancestors ( )
199+ . find ( |d| d. join ( "nupackage.toml" ) . exists ( ) )
200+ {
201+ manifest:: warn_if_legacy_toml_manifest ( dir) ;
202+ return Err ( error:: QuiverError :: NoManifest ( dir. to_path_buf ( ) ) ) ;
203+ }
204+ Err ( error:: QuiverError :: NoManifest ( start. to_path_buf ( ) ) )
196205}
197206
198207fn cmd_init (
Original file line number Diff line number Diff line change @@ -200,6 +200,16 @@ impl PluginDependencySpec {
200200 }
201201}
202202
203+ pub ( crate ) fn warn_if_legacy_toml_manifest ( dir : & Path ) {
204+ if dir. join ( "nupackage.toml" ) . exists ( ) {
205+ ui:: warn ( "nupackage.toml detected but quiver now requires nupackage.nuon. Migrate with:" ) ;
206+ ui:: plain ( " open nupackage.toml | to nuon --indent 2 | save -f nupackage.nuon" ) ;
207+ ui:: plain ( " rm nupackage.toml" ) ;
208+ ui:: plain ( " rm quiver.lock" ) ;
209+ ui:: plain ( " qv install" ) ;
210+ }
211+ }
212+
203213fn validate_ref_fields (
204214 name : & str ,
205215 kind : & str ,
@@ -235,17 +245,7 @@ impl Manifest {
235245 pub fn from_dir ( dir : & Path ) -> Result < Self > {
236246 let path = dir. join ( MANIFEST_FILE_NAME ) ;
237247 if !path. exists ( ) {
238- if dir. join ( "nupackage.toml" ) . exists ( ) {
239- ui:: warn (
240- "nupackage.toml detected but quiver now requires nupackage.nuon. Migrate with:" ,
241- ) ;
242- eprintln ! ( ) ;
243- eprintln ! ( " open nupackage.toml | to nuon --indent 2 | save -f nupackage.nuon" ) ;
244- eprintln ! ( " rm nupackage.toml" ) ;
245- eprintln ! ( " rm quiver.lock" ) ;
246- eprintln ! ( " qv install" ) ;
247- eprintln ! ( ) ;
248- }
248+ warn_if_legacy_toml_manifest ( dir) ;
249249 return Err ( QuiverError :: NoManifest ( dir. to_path_buf ( ) ) ) ;
250250 }
251251 let content = std:: fs:: read_to_string ( & path) ?;
Original file line number Diff line number Diff line change @@ -49,6 +49,13 @@ fn is_capturing() -> bool {
4949 LOG_CAPTURE . with ( |capture| capture. borrow ( ) . is_some ( ) )
5050}
5151
52+ pub fn plain ( message : impl AsRef < str > ) {
53+ let message = message. as_ref ( ) ;
54+ if !capture_line ( LogKind :: Info , message. to_string ( ) ) {
55+ eprintln ! ( "{}" , message) ;
56+ }
57+ }
58+
5259pub fn info ( message : impl AsRef < str > ) {
5360 let message = message. as_ref ( ) ;
5461 if !capture_line ( LogKind :: Info , message. to_string ( ) ) {
You can’t perform that action at this time.
0 commit comments