check if there is notes before show
This commit is contained in:
		
							parent
							
								
									aa7924e693
								
							
						
					
					
						commit
						3b30f116cc
					
				| @ -278,6 +278,9 @@ pub fn show_all() -> Result<()> { | |||||||
|             files.push(fs::read_to_string(file.path())?); |             files.push(fs::read_to_string(file.path())?); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |     if files.is_empty() { | ||||||
|  |         return Err(anyhow!("No notes found.")); | ||||||
|  |     } | ||||||
|     let skin = show::make_skin(); |     let skin = show::make_skin(); | ||||||
|     let md = &files.join("---\n"); |     let md = &files.join("---\n"); | ||||||
|     show::run_app(skin, md)?; |     show::run_app(skin, md)?; | ||||||
| @ -313,6 +316,9 @@ pub fn show_category(category: &str) -> Result<()> { | |||||||
|                 files.push(fs::read_to_string(file.path())?); |                 files.push(fs::read_to_string(file.path())?); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |         if files.is_empty() { | ||||||
|  |             return Err(anyhow!("No notes found.")); | ||||||
|  |         } | ||||||
|         let skin = show::make_skin(); |         let skin = show::make_skin(); | ||||||
|         let md = &files.join("---\n"); |         let md = &files.join("---\n"); | ||||||
|         show::run_app(skin, md)?; |         show::run_app(skin, md)?; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Volodymyr Patuta
						Volodymyr Patuta