diff options
| -rw-r--r-- | .gitignore | 2 | ||||
| -rw-r--r-- | Cargo.lock | 6 | ||||
| -rw-r--r-- | Cargo.toml | 9 | ||||
| -rw-r--r-- | src/main.rs | 17 |
4 files changed, 34 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..53eaa21 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/target +**/*.rs.bk diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..ccb7958 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,6 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "bag" +version = "0.1.0" + diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..23f6333 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "bag" +version = "0.1.0" +authors = ["kamulos"] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..fe0d61e --- /dev/null +++ b/src/main.rs @@ -0,0 +1,17 @@ +fn main() { + let mut it = std::env::args(); + + println!("who am i: {}", it.next().unwrap()); + + match it.next() { + Some(x) => match x.as_str() { + "init" => println!("Initializing..."), + _ => println!("unknown command"), + }, + _ => println!("not enough arguments"), + } + + for arg in it { + println!("{}", arg); + } +} |
