Skip to content

Commit a372464

Browse files
committed
use latest glint
1 parent acfe038 commit a372464

File tree

4 files changed

+18
-16
lines changed

4 files changed

+18
-16
lines changed

gleam.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
name = "gladvent"
2-
version = "0.7.0"
2+
version = "0.7.1"
33
repository = { type = "github", user = "TanklesXL", repo = "gladvent" }
44
description = "An Advent Of Code runner for gleam"
55
licences = ["Apache-2.0"]
66
internal_modules = ["gladvent/internal/*"]
77
gleam = "~> 1.0"
88

99
[dependencies]
10-
glint = "~> 0.17.1"
10+
glint = "~> 0.18"
1111
simplifile = "~> 0.3"
1212
argv = "~> 1.0"
1313
shellout = "~> 1.6"

manifest.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ packages = [
1212
{ name = "gleam_stdlib", version = "0.36.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "C0D14D807FEC6F8A08A7C9EF8DFDE6AE5C10E40E21325B2B29365965D82EB3D4" },
1313
{ name = "glearray", version = "0.2.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "glearray", source = "hex", outer_checksum = "908154F695D330E06A37FAB2C04119E8F315D643206F8F32B6A6C14A8709FFF4" },
1414
{ name = "gleeunit", version = "1.0.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "D364C87AFEB26BDB4FB8A5ABDE67D635DC9FA52D6AB68416044C35B096C6882D" },
15-
{ name = "glint", version = "0.17.1", build_tools = ["gleam"], requirements = ["gleam_community_ansi", "gleam_community_colour", "gleam_stdlib", "snag"], otp_app = "glint", source = "hex", outer_checksum = "DF094D7A97C54F4A23F670A7109A188DCBBDD17E003B3E650566835BDBA6BFDF" },
15+
{ name = "glint", version = "0.18.0", build_tools = ["gleam"], requirements = ["gleam_community_ansi", "gleam_community_colour", "gleam_stdlib", "snag"], otp_app = "glint", source = "hex", outer_checksum = "BB0F14643CC51C069A5DC6E9082EAFCD9967AFD1C9CC408803D1A40A3FD43B54" },
1616
{ name = "repeatedly", version = "2.1.1", build_tools = ["gleam"], requirements = [], otp_app = "repeatedly", source = "hex", outer_checksum = "38808C3EC382B0CD981336D5879C24ECB37FCB9C1D1BD128F7A80B0F74404D79" },
1717
{ name = "shellout", version = "1.6.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "shellout", source = "hex", outer_checksum = "E2FCD18957F0E9F67E1F497FC9FF57393392F8A9BAEAEA4779541DE7A68DD7E0" },
1818
{ name = "simplifile", version = "0.4.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "8F3C94B83F691CCFACD784A4D7C1F7E5A0437D93341549B908EE3B32E3477447" },
@@ -29,7 +29,7 @@ gleam_otp = { version = "~> 0.4" }
2929
gleam_package_interface = { version = "~> 1.0" }
3030
gleam_stdlib = { version = "~> 0.36 or ~> 1.0" }
3131
gleeunit = { version = "~> 1.0" }
32-
glint = { version = "~> 0.17.1" }
32+
glint = { version = "~> 0.18" }
3333
shellout = { version = "~> 1.6" }
3434
simplifile = { version = "~> 0.3" }
3535
snag = { version = "~> 0.2" }

src/gladvent.gleam

+10-4
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,17 @@ pub fn main() {
1515
glint.new()
1616
|> glint.with_name("gladvent")
1717
|> glint.as_gleam_module
18-
|> glint.global_flag(cmd.year, cmd.year_flag())
18+
|> glint.group_flag(at: [], for: cmd.year, of: cmd.year_flag())
1919
|> glint.with_pretty_help(glint.default_pretty_help())
20-
|> glint.add(["new"], new.new_command())
21-
|> glint.add(["run"], run.run_command())
22-
|> glint.add(["run", "all"], run.run_all_command())
20+
|> glint.add(at: ["new"], do: new.new_command())
21+
|> glint.group_flag(at: ["run"], for: run.timeout, of: run.timeout_flag())
22+
|> glint.group_flag(
23+
at: ["run"],
24+
for: run.allow_crash,
25+
of: run.allow_crash_flag(),
26+
)
27+
|> glint.add(at: ["run"], do: run.run_command())
28+
|> glint.add(at: ["run", "all"], do: run.run_all_command())
2329

2430
use out <- glint.run_and_handle(commands, argv.load().arguments)
2531
case out {

src/gladvent/internal/cmd/run.gleam

+4-8
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,11 @@ fn collect(year: Int, x: #(Day, RunResult)) -> String {
233233

234234
// ----- CLI -----
235235

236-
const timeout = "timeout"
236+
pub const timeout = "timeout"
237237

238-
const allow_crash = "allow-crash"
238+
pub const allow_crash = "allow-crash"
239239

240-
fn timeout_flag() {
240+
pub fn timeout_flag() {
241241
flag.int()
242242
|> flag.constraint(fn(i) {
243243
case i > 0 {
@@ -248,7 +248,7 @@ fn timeout_flag() {
248248
|> flag.description("Run with specified timeout")
249249
}
250250

251-
fn allow_crash_flag() {
251+
pub fn allow_crash_flag() {
252252
flag.bool()
253253
|> flag.default(False)
254254
|> flag.description("Don't catch exceptions thrown by runners")
@@ -277,8 +277,6 @@ pub fn run_command() -> glint.Command(Result(List(String))) {
277277
))
278278
|> Ok
279279
}
280-
|> glint.flag(timeout, timeout_flag())
281-
|> glint.flag(allow_crash, allow_crash_flag())
282280
|> glint.description("Run the specified days")
283281
|> glint.unnamed_args(glint.MinArgs(1))
284282
}
@@ -316,8 +314,6 @@ pub fn run_all_command() -> glint.Command(Result(List(String))) {
316314
))
317315
|> Ok
318316
}
319-
|> glint.flag(timeout, timeout_flag())
320-
|> glint.flag(allow_crash, allow_crash_flag())
321317
|> glint.description("Run all registered days")
322318
|> glint.unnamed_args(glint.EqArgs(0))
323319
}

0 commit comments

Comments
 (0)