Improved helper scripts

This commit is contained in:
Sven Heidemann 2023-11-28 15:24:58 +00:00
parent af2687fe11
commit f09473b5cc
4 changed files with 7 additions and 5 deletions

View File

@ -1,3 +1,3 @@
#!/bin/bash #!/bin/bash
dart run src/day$1.dart $1 dart run src/day$1.dart $2 $1

View File

@ -2,8 +2,7 @@ import 'dart:io';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
Map<String, String> getCookieHeaders() { Map<String, String> getCookieHeaders() {
print(Directory.current.path); var env = File('.env');
var env = File('../.env');
if (!env.existsSync()) { if (!env.existsSync()) {
throw Exception('Session key from https://adventofcode.com/ required'); throw Exception('Session key from https://adventofcode.com/ required');
} }

View File

@ -8,6 +8,9 @@ void secondPart() {}
Future<void> main(List<String> args) async { Future<void> main(List<String> args) async {
if (args.isEmpty) { if (args.isEmpty) {
print("Expected year");
return;
} else if (args.length < 2) {
print("Expected day"); print("Expected day");
return; return;
} }

View File

@ -10,11 +10,11 @@ if [ -z "$2" ]; then
exit; exit;
fi fi
if [ $2 > 25 ]; then if [ ${2} -ge 25 ]; then
echo "Invalid day" echo "Invalid day"
exit; exit;
fi fi
cd $1 cd $1
./run_day $2 ./run_day $2 $1