### Install Gleam 'dev' Package Source: https://github.com/bgwdotdev/shore/blob/main/examples/dev/README.md Use the Gleam package manager to add the 'dev' package to your project at version 1. ```Shell gleam add dev@1 ``` -------------------------------- ### Basic mux Gleam project import Source: https://github.com/bgwdotdev/shore/blob/main/examples/mux/README.md Illustrates the standard way to import the 'mux' library into a Gleam project's main function, serving as a placeholder for further usage examples. ```Gleam import mux pub fn main() { // TODO: An example of the project in use } ``` -------------------------------- ### Install Gleam Reader Package Source: https://github.com/bgwdotdev/shore/blob/main/examples/reader/README.md Installs the 'reader' package as a dependency in a Gleam project using the 'gleam add' command, specifying version 1. ```Shell gleam add reader@1 ``` -------------------------------- ### Gleam Reader Package Basic Usage Example Source: https://github.com/bgwdotdev/shore/blob/main/examples/reader/README.md Demonstrates the basic structure for importing the 'reader' package in a Gleam application. The 'main' function serves as a placeholder for further implementation of the package's functionality. ```Gleam import reader pub fn main() { // TODO: An example of the project in use } ``` -------------------------------- ### Gleam 'dev' Package Basic Usage Source: https://github.com/bgwdotdev/shore/blob/main/examples/dev/README.md A basic Gleam program demonstrating how to import the 'dev' package. This snippet serves as a starting point for integrating the package into a Gleam application. ```Gleam import dev pub fn main() { // TODO: An example of the project in use } ``` -------------------------------- ### Install mux Gleam package Source: https://github.com/bgwdotdev/shore/blob/main/examples/mux/README.md Command to add the 'mux' package as a dependency to a Gleam project, specifying version 1. ```Shell gleam add mux@1 ``` -------------------------------- ### Install Shore Gleam package Source: https://github.com/bgwdotdev/shore/blob/main/README.md Command to add the Shore package to a Gleam project using the Gleam package manager. ```sh gleam add shore@1 ``` -------------------------------- ### Install Gleam Counter Package Source: https://github.com/bgwdotdev/shore/blob/main/examples/counter/README.md Command to add the 'counter' package as a dependency to a Gleam project using the `gleam add` command. ```sh gleam add counter@1 ``` -------------------------------- ### Basic Gleam Shore TUI application Source: https://github.com/bgwdotdev/shore/blob/main/README.md A complete example of a simple Shore TUI application in Gleam, demonstrating the `init`, `update`, and `view` functions following The Elm Architecture. It includes counter logic and basic UI elements. ```gleam import gleam/erlang/process import gleam/int import gleam/option.{Some} import shore import shore/key import shore/layout import shore/style import shore/ui // MAIN pub fn main() { let exit = process.new_subject() let assert Ok(_actor) = shore.spec( init:, update:, view:, exit:, keybinds: shore.default_keybinds(), redraw: shore.on_timer(16), ) |> shore.start exit |> process.receive_forever } // MODEL pub opaque type Model { Model(counter: Int) } fn init() -> #(Model, List(fn() -> Msg)) { let model = Model(counter: 0) let cmds = [] #(model, cmds) } // UPDATE pub opaque type Msg { Increment Decrement } fn update(model: Model, msg: Msg) -> #(Model, List(fn() -> Msg)) { case msg { Increment -> #(Model(counter: model.counter + 1), []) Decrement -> #(Model(counter: model.counter - 1), []) } } // VIEW fn view(model: Model) -> shore.Node(Msg) { ui.box( [ ui.text( "keybinds i: increments d: decrements ctrl+x: exits ", ), ui.text(int.to_string(model.counter)), ui.br(), ui.row([ ui.button("increment", key.Char("i"), Increment), ui.button("decrement", key.Char("d"), Decrement), ]), ], Some("counter"), ) |> ui.align(style.Center, _) |> layout.center(style.Px(50), style.Px(12)) } ``` -------------------------------- ### Gleam Project Development Commands Source: https://github.com/bgwdotdev/shore/blob/main/examples/dev/README.md Essential shell commands for developers to run the Gleam project and execute its test suite. ```Shell gleam run # Run the project gleam test # Run the tests ``` -------------------------------- ### Run and test Gleam project Source: https://github.com/bgwdotdev/shore/blob/main/examples/mux/README.md Standard shell commands for executing and testing a Gleam project, useful for local development and verification. ```Shell gleam run gleam test ``` -------------------------------- ### Run Gleam Project Source: https://github.com/bgwdotdev/shore/blob/main/examples/layouts/README.md Executes the Gleam project, compiling and running it. This command is typically used during development to test the application. ```Shell gleam run # Run the project ``` -------------------------------- ### Gleam Project Structure with Counter Import Source: https://github.com/bgwdotdev/shore/blob/main/examples/counter/README.md Illustrates the basic structure of a Gleam project, including how to import the 'counter' module and a placeholder 'main' function. ```gleam import counter pub fn main() { // TODO: An example of the project in use } ``` -------------------------------- ### Run Gleam Project Source: https://github.com/bgwdotdev/shore/blob/main/examples/reader/README.md Executes the current Gleam project using the 'gleam run' command, typically used for development or testing purposes. ```Shell gleam run ``` -------------------------------- ### Run Gleam Tests Source: https://github.com/bgwdotdev/shore/blob/main/examples/reader/README.md Executes the test suite for the current Gleam project using the 'gleam test' command, ensuring code quality and functionality. ```Shell gleam test ``` -------------------------------- ### Gleam Project Development Workflow Source: https://github.com/bgwdotdev/shore/blob/main/examples/counter/README.md Essential shell commands for running and testing a Gleam project during the development phase. ```sh gleam run # Run the project gleam test # Run the tests ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.