Skip to content

Instantly share code, notes, and snippets.

@asdfsx
Last active November 11, 2016 04:05
Show Gist options
  • Save asdfsx/6d9504d59d56392327fb557192662d11 to your computer and use it in GitHub Desktop.
Save asdfsx/6d9504d59d56392327fb557192662d11 to your computer and use it in GitHub Desktop.
use std::env;
fn main() {
let mut tomlfile = "";
for argument in env::args() {
let tmp = &*argument;
if tmp.contains("toml=") {
println!("{}", &tmp[5 .. tmp.len()]);
tomlfile = &tmp[5 .. tmp.len()];
}
}
println!("{}", tomlfile);
}
@asdfsx
Copy link
Author

asdfsx commented Nov 11, 2016

new code:

use std::env;

fn main() {
    let mut tomlfile = String::new();

    for argument in env::args() {
        let tmp = &*argument;
        if tmp.contains("toml=") {
            tomlfile = (&tmp[5 .. tmp.len()]).to_string();
        }
    }

    println!("{}", tomlfile);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment