Skip to content

Commit

Permalink
run gleam fix and update for gleam 0.33
Browse files Browse the repository at this point in the history
  • Loading branch information
TanklesXL committed Dec 29, 2023
1 parent 6cc046b commit 3c2ebad
Show file tree
Hide file tree
Showing 16 changed files with 122 additions and 129 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
matrix:
erlang: ["25.3.2.3", "26.0.2"]
gleam: ["0.32.4"]
gleam: ["0.33.0"]
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.32.4"
gleam-version: "0.33.0"
- name: publish to hex
env:
HEXPM_USER: ${{ secrets.HEXPM_USER }}
Expand Down
2 changes: 0 additions & 2 deletions .tool-versions

This file was deleted.

5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Changelog

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

- updated to work with gleam 0.33
- removed deprecated stub api

## [0.13.0](https://github.com/TanklesXL/glint/compare/v0.12.0...v0.13.0)

Expand Down
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,14 @@ gleam add glint
1. assign the command a custom description
1. run your cli with `glnt.run`, run with a function to handle command output with `glint.run_and_handle`

### Mini Example
## ✨ Complementary packages

Glint works amazingly with these other packages:

- [argv](https://github.com/lpil/argv), use this for cross-platform argument fetching
- [gleescript](https://github.com/lpil/gleescript), use this to generate erlang escripts for your applications

## Mini Example

You can import `glint` as a dependency and use it to build simple command-line applications like the following simplified version of the [the hello world example](https://github.com/TanklesXL/glint/tree/main/examples/hello/README.md)

Expand All @@ -41,13 +48,10 @@ import gleam/result
import gleam/string.{uppercase}
// external dep imports
import snag
import argv
// glint imports
import glint
import glint/flag
// erlang-specific imports
@target(erlang)
import gleam/erlang.{start_arguments}
/// the key for the caps flag
const caps = "caps"
Expand Down Expand Up @@ -99,6 +103,6 @@ pub fn main() {
// with a short description
|> glint.description("Prints Hello, <NAME>!"),
)
|> glint.run(start_arguments())
|> glint.run(argv.load().arguments)
}
```
3 changes: 1 addition & 2 deletions examples/hello/.github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ jobs:
- uses: erlef/[email protected]
with:
otp-version: "25.2"
gleam-version: "0.30.3"
gleam-version: "0.33.0"
rebar3-version: "3"
# elixir-version: "1.14.2"
- run: gleam format --check src test
- run: gleam deps download
- run: gleam test
6 changes: 4 additions & 2 deletions examples/hello/gleam.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name = "hello"
version = "0.1.0"
description = "A Gleam project"
gleam = ">= 0.33.0"

# Fill out these fields if you intend to generate HTML documentation or publish
# your project to the Hex package manager.
Expand All @@ -13,7 +14,8 @@ description = "A Gleam project"
gleam_stdlib = "~> 0.29"
glint = { path = "../.." }
snag = "~> 0.2"
gleam_erlang = "~> 0.19"
argv = "~> 1.0"

[dev-dependencies]
gleeunit = "~> 0.10"
gleeunit = "~> 1.0"
gleescript = "~> 1.0"
25 changes: 15 additions & 10 deletions examples/hello/manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,24 @@
# You typically do not need to edit this file

packages = [
{ name = "gleam_bitwise", version = "1.3.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_bitwise", source = "hex", outer_checksum = "E2A46EE42E5E9110DAD67E0F71E7358CBE54D5EC22C526DD48CBBA3223025792" },
{ name = "gleam_community_ansi", version = "1.1.0", build_tools = ["gleam"], requirements = ["gleam_community_colour", "gleam_stdlib", "gleam_bitwise"], otp_app = "gleam_community_ansi", source = "hex", outer_checksum = "6E4E0CF2B207C1A7FCD3C21AA43514D67BC7004F21F82045CDCCE6C727A14862" },
{ name = "gleam_community_colour", version = "1.1.0", build_tools = ["gleam"], requirements = ["gleam_bitwise", "gleam_stdlib"], otp_app = "gleam_community_colour", source = "hex", outer_checksum = "D27CE357ECB343929A8CEC3FBA0B499943A47F0EE1F589EE16AFC2DC21C61E5B" },
{ name = "gleam_erlang", version = "0.22.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_erlang", source = "hex", outer_checksum = "367D8B41A7A86809928ED1E7E55BFD0D46D7C4CF473440190F324AFA347109B4" },
{ name = "gleam_stdlib", version = "0.31.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "6D1BC5B4D4179B9FEE866B1E69FE180AC2CE485AD90047C0B32B2CA984052736" },
{ name = "gleeunit", version = "0.11.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "1397E5C4AC4108769EE979939AC39BF7870659C5AFB714630DEEEE16B8272AD5" },
{ name = "glint", version = "0.12.1", build_tools = ["gleam"], requirements = ["gleam_community_ansi", "gleam_community_colour", "gleam_stdlib", "snag"], source = "local", path = "../.." },
{ name = "snag", version = "0.2.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "snag", source = "hex", outer_checksum = "8FD70D8FB3728E08AC425283BB509BB0F012BE1AE218424A597CDE001B0EE589" },
{ name = "argv", version = "1.0.1", build_tools = ["gleam"], requirements = [], otp_app = "argv", source = "hex", outer_checksum = "A6E9009E50BBE863EB37D963E4315398D41A3D87D0075480FC244125808F964A" },
{ name = "filepath", version = "0.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "filepath", source = "hex", outer_checksum = "534E8161A0DE192A9A105EFEC34369E9FD5834BB58ED449B5ACAEE8704358588" },
{ name = "gleam_community_ansi", version = "1.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib", "gleam_community_colour"], otp_app = "gleam_community_ansi", source = "hex", outer_checksum = "AB7C3CCC894653637E02DC455D5890C8CF3064E83E78CFE61145A4C458D02DE6" },
{ name = "gleam_community_colour", version = "1.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_community_colour", source = "hex", outer_checksum = "A49A5E3AE8B637A5ACBA80ECB9B1AFE89FD3D5351FF6410A42B84F666D40D7D5" },
{ name = "gleam_erlang", version = "0.23.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_erlang", source = "hex", outer_checksum = "C21CFB816C114784E669FFF4BBF433535EEA9960FA2F216209B8691E87156B96" },
{ name = "gleam_stdlib", version = "0.34.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "1FB8454D2991E9B4C0C804544D8A9AD0F6184725E20D63C3155F0AEB4230B016" },
{ name = "gleescript", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib", "gleam_erlang", "snag", "tom", "filepath", "simplifile"], otp_app = "gleescript", source = "hex", outer_checksum = "F7C152E206167000420F90983E4D4A076703292AAC4335A9248BA46D380841AC" },
{ name = "gleeunit", version = "1.0.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "D364C87AFEB26BDB4FB8A5ABDE67D635DC9FA52D6AB68416044C35B096C6882D" },
{ name = "glint", version = "0.14.0", build_tools = ["gleam"], requirements = ["gleam_community_ansi", "gleam_community_colour", "gleam_stdlib", "snag"], source = "local", path = "../.." },
{ name = "simplifile", version = "1.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "2B7070FB8617474A35651F6AA27046576615C14A4D97B62FA7C40C24C55A6C5C" },
{ name = "snag", version = "0.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "snag", source = "hex", outer_checksum = "54D32E16E33655346AA3E66CBA7E191DE0A8793D2C05284E3EFB90AD2CE92BCC" },
{ name = "tom", version = "0.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "tom", source = "hex", outer_checksum = "0831C73E45405A2153091226BF98FB485ED16376988602CC01A5FD086B82D577" },
]

[requirements]
gleam_erlang = { version = "~> 0.19" }
argv = { version = "~> 1.0" }
gleam_stdlib = { version = "~> 0.29" }
gleeunit = { version = "~> 0.10" }
gleescript = { version = "~> 1.0" }
gleeunit = { version = "~> 1.0" }
glint = { path = "../.." }
snag = { version = "~> 0.2" }
7 changes: 2 additions & 5 deletions examples/hello/src/hello.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import snag
// glint imports
import glint
import glint/flag
// erlang-specific imports
@target(erlang)
import gleam/erlang.{start_arguments}
import argv

// ----- APPLICATION LOGIC -----

Expand Down Expand Up @@ -122,8 +120,7 @@ pub fn app() {
)
}

@target(erlang)
pub fn main() {
// run with a handler that prints the command output
glint.run_and_handle(app(), start_arguments(), io.println)
glint.run_and_handle(app(), argv.load().arguments, io.println)
}
6 changes: 3 additions & 3 deletions gleam.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name = "glint"
version = "0.13.0"
version = "0.14.0"

# Fill out these fields if you intend to generate HTML documentation or publishname = "glint"
# your project to the Hex package manager.
Expand All @@ -11,7 +11,7 @@ links = [
{ title = "Hex", href = "https://hex.pm/packages/glint" },
{ title = "Docs", href = "https://hexdocs.pm/glint/" },
]
gleam = ">= 0.32.0"
gleam = ">= 0.33.0"

[dependencies]
gleam_stdlib = "~> 0.19"
Expand All @@ -20,4 +20,4 @@ gleam_community_ansi = "~> 1.0"
gleam_community_colour = "~> 1.0"

[dev-dependencies]
gleeunit = "~> 0.5"
gleeunit = "~> 1.0"
12 changes: 6 additions & 6 deletions manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
# You typically do not need to edit this file

packages = [
{ name = "gleam_community_ansi", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_community_colour", "gleam_stdlib"], otp_app = "gleam_community_ansi", source = "hex", outer_checksum = "8B5A9677BC5A2738712BBAF2BA289B1D8195FDF962BBC769569976AD5E9794E1" },
{ name = "gleam_community_colour", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_community_colour", source = "hex", outer_checksum = "036C206886AFB9F153C552700A7A0B4D2864E3BC96A20C77E5F34A013C051BE3" },
{ name = "gleam_stdlib", version = "0.32.1", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "ABF00CDCCB66FABBCE351A50060964C4ACE798F95A0D78622C8A7DC838792577" },
{ name = "gleeunit", version = "0.11.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "1397E5C4AC4108769EE979939AC39BF7870659C5AFB714630DEEEE16B8272AD5" },
{ name = "snag", version = "0.2.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "snag", source = "hex", outer_checksum = "8FD70D8FB3728E08AC425283BB509BB0F012BE1AE218424A597CDE001B0EE589" },
{ name = "gleam_community_ansi", version = "1.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib", "gleam_community_colour"], otp_app = "gleam_community_ansi", source = "hex", outer_checksum = "AB7C3CCC894653637E02DC455D5890C8CF3064E83E78CFE61145A4C458D02DE6" },
{ name = "gleam_community_colour", version = "1.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_community_colour", source = "hex", outer_checksum = "A49A5E3AE8B637A5ACBA80ECB9B1AFE89FD3D5351FF6410A42B84F666D40D7D5" },
{ name = "gleam_stdlib", version = "0.34.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "1FB8454D2991E9B4C0C804544D8A9AD0F6184725E20D63C3155F0AEB4230B016" },
{ name = "gleeunit", version = "1.0.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "D364C87AFEB26BDB4FB8A5ABDE67D635DC9FA52D6AB68416044C35B096C6882D" },
{ name = "snag", version = "0.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "snag", source = "hex", outer_checksum = "54D32E16E33655346AA3E66CBA7E191DE0A8793D2C05284E3EFB90AD2CE92BCC" },
]

[requirements]
gleam_community_ansi = { version = "~> 1.0" }
gleam_community_colour = { version = "~> 1.0" }
gleam_stdlib = { version = "~> 0.19" }
gleeunit = { version = "~> 0.5" }
gleeunit = { version = "~> 1.0" }
snag = { version = "~> 0.2" }
Loading

0 comments on commit 3c2ebad

Please sign in to comment.