refactor: update gleam_stdlib and glint version

This commit is contained in:
Santi Lertsumran 2024-11-17 16:01:36 +07:00
parent dd94d9fda8
commit 21920383be
2 changed files with 9 additions and 11 deletions

View File

@ -13,8 +13,8 @@ version = "1.0.0"
# https://gleam.run/writing-gleam/gleam-toml/.
[dependencies]
gleam_stdlib = ">= 0.38.0 and < 1.0.0"
glint = ">= 0.18.1 and < 1.0.0"
gleam_stdlib = ">= 0.42.0 and < 1.0.0"
glint = ">= 1.1.0 and < 2.0.0"
argv = ">= 1.0.2 and < 2.0.0"
[dev-dependencies]

View File

@ -6,32 +6,30 @@ import gleam/io
import gleam/list
import gleam/string
import glint
import glint/flag
pub fn main() {
run_cli_app(update_quality)
}
pub fn run_cli_app(modify_inventory: fn(GildedRose) -> GildedRose) {
let days_flag = "days"
let days_flag = glint.int_flag("days")
let number_of_days =
flag.int()
|> flag.default(2)
|> flag.description("Number of days")
days_flag
|> glint.flag_default(2)
|> glint.flag_help("Number of days")
let simulate_inventory = fn() {
use input <- glint.command()
use _, _, flags <- glint.command()
let assert Ok(number_of_days) =
flag.get_int(from: input.flags, for: days_flag)
let assert Ok(number_of_days) = glint.get_flag(from: flags, for: days_flag)
simulate(number_of_days, modify_inventory)
}
let app =
glint.new()
|> glint.with_name("Gilded Rose")
|> glint.group_flag([], days_flag, number_of_days)
|> glint.group_flag([], number_of_days)
|> glint.add(at: [], do: simulate_inventory())
io.println("OMGHAI!")