From f09473b5cc08f1aa558aac14162b51d886f20b37 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Tue, 28 Nov 2023 15:24:58 +0000 Subject: [PATCH] Improved helper scripts --- 2023/run_day | 2 +- 2023/src/aoc/helper.dart | 3 +-- 2023/src/template.dart | 3 +++ run_day | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/2023/run_day b/2023/run_day index b7c3280..e397c2d 100755 --- a/2023/run_day +++ b/2023/run_day @@ -1,3 +1,3 @@ #!/bin/bash -dart run src/day$1.dart $1 \ No newline at end of file +dart run src/day$1.dart $2 $1 \ No newline at end of file diff --git a/2023/src/aoc/helper.dart b/2023/src/aoc/helper.dart index c780ccf..a7c55bc 100644 --- a/2023/src/aoc/helper.dart +++ b/2023/src/aoc/helper.dart @@ -2,8 +2,7 @@ import 'dart:io'; import 'package:http/http.dart' as http; Map getCookieHeaders() { - print(Directory.current.path); - var env = File('../.env'); + var env = File('.env'); if (!env.existsSync()) { throw Exception('Session key from https://adventofcode.com/ required'); } diff --git a/2023/src/template.dart b/2023/src/template.dart index cf04515..d0bc14b 100644 --- a/2023/src/template.dart +++ b/2023/src/template.dart @@ -8,6 +8,9 @@ void secondPart() {} Future main(List args) async { if (args.isEmpty) { + print("Expected year"); + return; + } else if (args.length < 2) { print("Expected day"); return; } diff --git a/run_day b/run_day index 60a482d..b902cd4 100755 --- a/run_day +++ b/run_day @@ -10,11 +10,11 @@ if [ -z "$2" ]; then exit; fi -if [ $2 > 25 ]; then +if [ ${2} -ge 25 ]; then echo "Invalid day" exit; fi cd $1 -./run_day $2 \ No newline at end of file +./run_day $2 $1 \ No newline at end of file