Linux command
gleam 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Create new project
gleam new [project_name]
Build project
gleam build
Run project
gleam run
Run tests
gleam test
Add a Hex dependency
gleam add [package_name]
Remove a dependency
gleam remove [package_name]
Format source code
gleam format
Generate HTML documentation
gleam docs build
说明
gleam is the build tool and compiler for the Gleam programming language, a type-safe functional language that compiles to Erlang and JavaScript. It manages projects, dependencies, compilation, testing, and documentation. Gleam integrates with the Hex package manager for the Erlang/Elixir ecosystem and can interoperate with Erlang and Elixir code. The JavaScript target allows Gleam to run in browsers and Node.js/Deno/Bun.
参数
- new _NAME_
- Create a new project with standard directory structure.
- build
- Compile the project and its dependencies.
- run
- Build and run the project.
- test
- Build and run the test suite.
- add _PACKAGE_
- Add a Hex package dependency.
- remove _PACKAGE_
- Remove a dependency.
- check
- Type-check the project without producing build artifacts.
- format
- Format source code files.
- docs build
- Generate HTML documentation.
- docs publish
- Publish documentation to HexDocs.
- publish
- Publish the package to Hex.
- shell
- Start an Erlang shell with the project loaded.
- export erlang-shipment
- Export a standalone Erlang release for deployment.
- --target _TARGET_
- Compile target: erlang or javascript.
- --help
- Display help information.
FAQ
What is the gleam command used for?
gleam is the build tool and compiler for the Gleam programming language, a type-safe functional language that compiles to Erlang and JavaScript. It manages projects, dependencies, compilation, testing, and documentation. Gleam integrates with the Hex package manager for the Erlang/Elixir ecosystem and can interoperate with Erlang and Elixir code. The JavaScript target allows Gleam to run in browsers and Node.js/Deno/Bun.
How do I run a basic gleam example?
Run `gleam new [project_name]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does new _NAME_ do in gleam?
Create a new project with standard directory structure.