Skip to content

Commit

Permalink
support gleam v1-rc1
Browse files Browse the repository at this point in the history
  • Loading branch information
TanklesXL committed Feb 11, 2024
1 parent 8c2aa99 commit 350dc4c
Show file tree
Hide file tree
Showing 10 changed files with 156 additions and 153 deletions.
2 changes: 1 addition & 1 deletion .github/actions/test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ inputs:
erlang-version:
description: erlang-otp version
required: false
default: 25.0.2
default: 26.2.2
node-version:
description: nodeJS version
required: false
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
erlang: ["25.3.2.3", "26.0.2"]
gleam: ["0.34.1"]
erlang: ["25.3.2.3", "26.2.2"]
gleam: ["0.34.1","1.0.0-rc1"]
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/test
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- uses: actions/checkout@v2
- uses: ./.github/actions/test
with:
gleam-version: "0.34.1"
gleam-version: "1.0.0-rc1"
- name: publish to hex
env:
HEXPM_USER: ${{ secrets.HEXPM_USER }}
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## [Unreleased](https://github.com/TanklesXL/glint/compare/v0.14.0...HEAD)

## [0.15.0-rc1](https://github.com/TanklesXL/glint/compare/v0.14.0...v0.15.0-rc1)
- support gleam >=0.34 or 1.0.x

## [0.15.0-rc1](https://github.com/TanklesXL/glint/compare/v0.14.0...v0.15.0-rc1)

- refactor of help generation logic, no change to help text output
Expand Down
2 changes: 1 addition & 1 deletion gleam.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ links = [
{ title = "Hex", href = "https://hex.pm/packages/glint" },
{ title = "Docs", href = "https://hexdocs.pm/glint/" },
]
gleam = ">= 0.33.0"
gleam = ">=0.34.1 or ~> 1.0"

[dependencies]
gleam_stdlib = "~> 0.19"
Expand Down
4 changes: 2 additions & 2 deletions src/glint.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -652,8 +652,8 @@ fn build_subcommands_help(
Metadata(
name: name,
description: cmd.contents
|> option.map(fn(command) { command.description })
|> option.unwrap(""),
|> option.map(fn(command) { command.description })
|> option.unwrap(""),
),
..acc
]
Expand Down
36 changes: 18 additions & 18 deletions src/glint/flag/constraint.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ pub fn one_of(allowed: List(a)) -> Constraint(a) {
False ->
snag.error(
"invalid value '"
<> string.inspect(val)
<> "', must be one of: ["
<> {
allowed
|> list.map(fn(a) { "'" <> string.inspect(a) <> "'" })
|> string.join(", ")
}
<> "]",
<> string.inspect(val)
<> "', must be one of: ["
<> {
allowed
|> list.map(fn(a) { "'" <> string.inspect(a) <> "'" })
|> string.join(", ")
}
<> "]",
)
}
}
Expand All @@ -43,16 +43,16 @@ pub fn none_of(disallowed: List(a)) -> Constraint(a) {
True ->
snag.error(
"invalid value '"
<> string.inspect(val)
<> "', must not be one of: ["
<> {
{
disallowed
|> list.map(fn(a) { "'" <> string.inspect(a) <> "'" })
|> string.join(", ")
<> "]"
}
},
<> string.inspect(val)
<> "', must not be one of: ["
<> {
{
disallowed
|> list.map(fn(a) { "'" <> string.inspect(a) <> "'" })
|> string.join(", ")
<> "]"
}
},
)
}
}
Expand Down
84 changes: 42 additions & 42 deletions test/glint/flag/contraint_test.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -60,78 +60,78 @@ pub fn flag_one_of_none_of_test() {
#(
"i",
flag.int()
|> flag.constraint(one_of([1, 2, 3]))
|> flag.constraint(none_of([4, 5, 6]))
|> flag.build,
|> flag.constraint(one_of([1, 2, 3]))
|> flag.constraint(none_of([4, 5, 6]))
|> flag.build,
"1",
"6",
),
#(
"li",
flag.int_list()
|> flag.constraint(
[1, 2, 3]
|> one_of
|> each,
)
|> flag.constraint(
[4, 5, 6]
|> none_of
|> each,
)
|> flag.build,
|> flag.constraint(
[1, 2, 3]
|> one_of
|> each,
)
|> flag.constraint(
[4, 5, 6]
|> none_of
|> each,
)
|> flag.build,
"1,1,1",
"2,2,6",
),
#(
"f",
flag.float()
|> flag.constraint(one_of([1.0, 2.0, 3.0]))
|> flag.constraint(none_of([4.0, 5.0, 6.0]))
|> flag.build,
|> flag.constraint(one_of([1.0, 2.0, 3.0]))
|> flag.constraint(none_of([4.0, 5.0, 6.0]))
|> flag.build,
"1.0",
"6.0",
),
#(
"lf",
flag.float_list()
|> flag.constraint(
[1.0, 2.0, 3.0]
|> one_of()
|> each,
)
|> flag.constraint(
[4.0, 5.0, 6.0]
|> none_of()
|> each,
)
|> flag.build,
|> flag.constraint(
[1.0, 2.0, 3.0]
|> one_of()
|> each,
)
|> flag.constraint(
[4.0, 5.0, 6.0]
|> none_of()
|> each,
)
|> flag.build,
"3.0,2.0,1.0",
"2.0,3.0,6.0",
),
#(
"s",
flag.string()
|> flag.constraint(one_of(["t1", "t2", "t3"]))
|> flag.constraint(none_of(["t4", "t5", "t6"]))
|> flag.build,
|> flag.constraint(one_of(["t1", "t2", "t3"]))
|> flag.constraint(none_of(["t4", "t5", "t6"]))
|> flag.build,
"t3",
"t4",
),
#(
"ls",
flag.string_list()
|> flag.constraint(
["t1", "t2", "t3"]
|> one_of
|> each,
)
|> flag.constraint(
["t4", "t5", "t6"]
|> none_of
|> each,
)
|> flag.build,
|> flag.constraint(
["t1", "t2", "t3"]
|> one_of
|> each,
)
|> flag.constraint(
["t4", "t5", "t6"]
|> none_of
|> each,
)
|> flag.build,
"t3,t2,t1",
"t2,t4,t1",
),
Expand Down
Loading

0 comments on commit 350dc4c

Please sign in to comment.