|
| 1 | +use clap::Parser; |
| 2 | + |
| 3 | +/// Generate a native-style macOS folder icon from a mask file. |
| 4 | +#[derive(Parser, Debug)] |
| 5 | +#[command(author, version, about, long_about = None)] |
| 6 | +struct Args { |
| 7 | + /// Mask image file. For best results: |
| 8 | + /// - Use a .png mask. |
| 9 | + /// - Use a solid black design over a transparent background. |
| 10 | + /// - Make sure the corner pixels of the mask image are transparent. They are used for empty margins. |
| 11 | + /// - Make sure the non-transparent pixels span a height of 384px, using a 16px grid. |
| 12 | + /// If the height is 384px and the width is a multiple of 128px, each 64x64 tile will exactly align with 1 pixel at the smallest folder size. |
| 13 | + #[clap(verbatim_doc_comment)] |
| 14 | + mask: std::path::PathBuf, |
| 15 | + /// Target file or folder. |
| 16 | + /// If a target is specified, the resulting icon will be applied to the target file/folder. |
| 17 | + /// Else, a .iconset folder and .icns file will be created in the same folder as the mask |
| 18 | + /// (you can use "Get Info" in Finder to copy the icon from the .icns file). |
| 19 | + #[clap(verbatim_doc_comment)] |
| 20 | + target: Option<std::path::PathBuf>, |
| 21 | + |
| 22 | + /// Reveal the target (or resulting .icns file) in Finder. |
| 23 | + #[clap(short, long)] |
| 24 | + reveal: bool, |
| 25 | + |
| 26 | + /// Version of the macOS folder icon, e.g. "10.13". |
| 27 | + /// Defaults to the version currently running. |
| 28 | + #[clap(long = "macOS", alias = "osx", short_alias = 'x')] |
| 29 | + mac_os: Option<String>, // TODO: enum, default? |
| 30 | + |
| 31 | + /// Color scheme: auto (match current system), light, dark. |
| 32 | + color_scheme: Option<String>, |
| 33 | +} |
| 34 | + |
| 35 | +fn main() { |
| 36 | + let args = Args::parse(); |
| 37 | + |
| 38 | + println!("Target: {}", args.mask.display()); |
| 39 | +} |
0 commit comments