forked from natto1784/tricc
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
/target
|
||||||
|
.direnv
|
||||||
|
*~
|
||||||
|
\#*\#
|
||||||
|
result*
|
@@ -1,8 +1,8 @@
|
|||||||
use std::env;
|
use std::env;
|
||||||
use std::process::exit;
|
use std::process::exit;
|
||||||
|
|
||||||
const VERSION: &'static str = env!("CARGO_PKG_VERSION");
|
const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||||
const CRATE: &'static str = env!("CARGO_CRATE_NAME");
|
const CRATE: &str = env!("CARGO_CRATE_NAME");
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
struct Options {
|
struct Options {
|
||||||
@@ -24,8 +24,8 @@ pub fn handle() -> String {
|
|||||||
for arg in &args[1..] {
|
for arg in &args[1..] {
|
||||||
match arg.as_str() {
|
match arg.as_str() {
|
||||||
"-v" | "--version" => options.version = true,
|
"-v" | "--version" => options.version = true,
|
||||||
flag if flag.chars().next() == Some('-') => panic!("option {} not implemented!", flag),
|
flag if flag.starts_with('-') => panic!("option {} not implemented!", flag),
|
||||||
file @ _ => {
|
file => {
|
||||||
if !options.file.is_empty() {
|
if !options.file.is_empty() {
|
||||||
panic!("please specify only a single source file!");
|
panic!("please specify only a single source file!");
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
use tricc::args;
|
use tricc::args;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
println!("Hello World!");
|
let file: String = args::handle();
|
||||||
|
println!("{}", file);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user