mirror of
https://github.com/bertptrs/adventofcode.git
synced 2025-12-25 21:00:31 +01:00
Split lib/bin.
This commit is contained in:
13
2018/src/lib.rs
Normal file
13
2018/src/lib.rs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
extern crate chrono;
|
||||||
|
#[macro_use] extern crate itertools;
|
||||||
|
extern crate regex;
|
||||||
|
|
||||||
|
pub mod common;
|
||||||
|
pub mod day01;
|
||||||
|
pub mod day02;
|
||||||
|
pub mod day03;
|
||||||
|
pub mod day04;
|
||||||
|
pub mod day05;
|
||||||
|
pub mod day06;
|
||||||
|
pub mod day07;
|
||||||
|
pub mod day08;
|
||||||
@@ -1,23 +1,14 @@
|
|||||||
extern crate chrono;
|
extern crate chrono;
|
||||||
extern crate clap;
|
extern crate clap;
|
||||||
#[macro_use] extern crate itertools;
|
extern crate aoc_2018;
|
||||||
extern crate regex;
|
|
||||||
|
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
|
|
||||||
use clap::{App, Arg};
|
use aoc_2018::*;
|
||||||
|
|
||||||
pub mod common;
|
use clap::{App, Arg};
|
||||||
pub mod day01;
|
|
||||||
pub mod day02;
|
|
||||||
pub mod day03;
|
|
||||||
pub mod day04;
|
|
||||||
pub mod day05;
|
|
||||||
pub mod day06;
|
|
||||||
pub mod day07;
|
|
||||||
pub mod day08;
|
|
||||||
|
|
||||||
fn get_impl(day: &str) -> Box<common::Solution> {
|
fn get_impl(day: &str) -> Box<common::Solution> {
|
||||||
match day.parse() {
|
match day.parse() {
|
||||||
@@ -39,23 +30,23 @@ fn main() {
|
|||||||
.version("2018")
|
.version("2018")
|
||||||
.author("Bert Peters <bert@bertptrs.nl>")
|
.author("Bert Peters <bert@bertptrs.nl>")
|
||||||
.arg(Arg::with_name("day")
|
.arg(Arg::with_name("day")
|
||||||
.value_name("DAY")
|
.value_name("DAY")
|
||||||
.help("Number of the day to execute")
|
.help("Number of the day to execute")
|
||||||
.required(true)
|
.required(true)
|
||||||
.takes_value(true))
|
.takes_value(true))
|
||||||
.arg(Arg::with_name("part2")
|
.arg(Arg::with_name("part2")
|
||||||
.short("2")
|
.short("2")
|
||||||
.help("Whether to run part 2")
|
.help("Whether to run part 2")
|
||||||
.long("part2"))
|
.long("part2"))
|
||||||
.arg(Arg::with_name("input")
|
.arg(Arg::with_name("input")
|
||||||
.short("i")
|
.short("i")
|
||||||
.long("input")
|
.long("input")
|
||||||
.help("Optional input file, stdin otherwise")
|
.help("Optional input file, stdin otherwise")
|
||||||
.takes_value(true))
|
.takes_value(true))
|
||||||
.arg(Arg::with_name("time")
|
.arg(Arg::with_name("time")
|
||||||
.short("t")
|
.short("t")
|
||||||
.long("time")
|
.long("time")
|
||||||
.help("Print the time for the result"))
|
.help("Print the time for the result"))
|
||||||
.get_matches();
|
.get_matches();
|
||||||
|
|
||||||
let mut implementation = get_impl(matches.value_of("day").unwrap());
|
let mut implementation = get_impl(matches.value_of("day").unwrap());
|
||||||
|
|||||||
Reference in New Issue
Block a user