Add a save current wallpaper option.
This commit is contained in:
		
							parent
							
								
									61d7108e5d
								
							
						
					
					
						commit
						d45d9a0b90
					
				| 
						 | 
				
			
			@ -11,12 +11,20 @@ async function main(): Promise<void> {
 | 
			
		|||
      default: 1080,
 | 
			
		||||
      depends: ["unsplash"],
 | 
			
		||||
    })
 | 
			
		||||
    .option(
 | 
			
		||||
      "--save-current <file:file>",
 | 
			
		||||
      "Save the current wallpaper to a different file",
 | 
			
		||||
    )
 | 
			
		||||
    .option("--width <width:number>", "The width of the image", {
 | 
			
		||||
      default: 1920,
 | 
			
		||||
      depends: ["unsplash"],
 | 
			
		||||
    })
 | 
			
		||||
    .parse(Deno.args);
 | 
			
		||||
 | 
			
		||||
  if (options.saveCurrent) {
 | 
			
		||||
    await Deno.copyFile(imagePath, options.saveCurrent);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (options.unsplash) {
 | 
			
		||||
    await downloadImage(
 | 
			
		||||
      `https://source.unsplash.com/random/${options.width}x${options.height}`,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Reference in New Issue