Skip to content

Instantly share code, notes, and snippets.

@tvaisanen
Created November 9, 2018 20:59
Show Gist options
  • Select an option

  • Save tvaisanen/7f7b8532410d26b7bc57c81d8f895605 to your computer and use it in GitHub Desktop.

Select an option

Save tvaisanen/7f7b8532410d26b7bc57c81d8f895605 to your computer and use it in GitHub Desktop.
use std::fs::OpenOptions;
fn main() {
// read the command line arguments
// and skip the first one, which
// is the command itself
for arg in std::env::args().skip(1) {
// get the filename from arg
let filename = format!("{}.js", arg);
// create the file
let _file = OpenOptions::new()
.write(true)
.create_new(true)
.open(filename).unwrap();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment