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,
 | 
					      default: 1080,
 | 
				
			||||||
      depends: ["unsplash"],
 | 
					      depends: ["unsplash"],
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
 | 
					    .option(
 | 
				
			||||||
 | 
					      "--save-current <file:file>",
 | 
				
			||||||
 | 
					      "Save the current wallpaper to a different file",
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
    .option("--width <width:number>", "The width of the image", {
 | 
					    .option("--width <width:number>", "The width of the image", {
 | 
				
			||||||
      default: 1920,
 | 
					      default: 1920,
 | 
				
			||||||
      depends: ["unsplash"],
 | 
					      depends: ["unsplash"],
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
    .parse(Deno.args);
 | 
					    .parse(Deno.args);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (options.saveCurrent) {
 | 
				
			||||||
 | 
					    await Deno.copyFile(imagePath, options.saveCurrent);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (options.unsplash) {
 | 
					  if (options.unsplash) {
 | 
				
			||||||
    await downloadImage(
 | 
					    await downloadImage(
 | 
				
			||||||
      `https://source.unsplash.com/random/${options.width}x${options.height}`,
 | 
					      `https://source.unsplash.com/random/${options.width}x${options.height}`,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Reference in New Issue