diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/aarty.iml b/.idea/aarty.iml new file mode 100644 index 0000000..9b4cf84 --- /dev/null +++ b/.idea/aarty.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/discord.xml b/.idea/discord.xml new file mode 100644 index 0000000..d8e9561 --- /dev/null +++ b/.idea/discord.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/.idea/jpa-buddy.xml b/.idea/jpa-buddy.xml new file mode 100644 index 0000000..966d5f5 --- /dev/null +++ b/.idea/jpa-buddy.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..59780fe --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..92602ca --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 9e8b08f..09b1230 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,7 @@ name = "aarty" version = "0.1.0" edition = "2021" +authors = ["Anas Elgarhy "] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/src/args.rs b/src/args.rs new file mode 100644 index 0000000..98301b7 --- /dev/null +++ b/src/args.rs @@ -0,0 +1,41 @@ +pub mod args { + use clap::{Parser, arg, ValueEnum, ColorChoice}; + + #[derive(Parser)] + #[command(author, version, about, long_about=None, color=ColorChoice::Always)] + pub struct Arguments { + /// The art mode to use + #[arg(short, long, default_value="normal-ascii")] + pub mode: Mode, + #[arg(long, default_value="stdout", alias="mo")] + pub output_method: OutputMethod, + /// The image to convert to ASCII art + pub image: String, + /// The output file to write to (if output_method is file) + #[arg(short, long, default_value=Some("ascii_image.txt"))] + pub output: Option, + } + + #[derive(Copy, Clone, ValueEnum, Debug, PartialOrd, Eq, PartialEq)] + pub enum Mode { + /// Normal ASCII art + #[clap(alias = "n")] + NormalAscii, + /// Colored ASCII art, the colors are based on the terminal colors + #[clap(alias = "c")] + COLORED, + } + + #[derive(Copy, Clone, ValueEnum, Debug, PartialOrd, Eq, PartialEq)] + pub enum OutputMethod { + /// Save the ascii art to a file + #[clap(alias = "f")] + File, + #[clap(alias = "c")] + /// Copy the ascii art to the clipboard + Clipboard, + /// Print the ascii art to the terminal + #[clap(alias = "s")] + Stdout, + } +} diff --git a/src/main.rs b/src/main.rs index e7a11a9..7b0da62 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,10 @@ +use clap::{Parser}; + +mod args; + +use crate::args::args::Arguments; + fn main() { + let arguments = Arguments::parse(); println!("Hello, world!"); }