Skip to content

Commit fe309e3

Browse files
committed
Start arguments
1 parent a126191 commit fe309e3

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## v0.2.0 - 2021-11-23
44

55
- Converted from rebar3 to the Gleam build tool.
6+
- The `erlang` module gains the `start_arguments` function.
67

78
## v0.1.0 - 2021-09-11
89

src/gleam/erlang.gleam

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,14 @@ pub type Crash {
9090
Thrown(Dynamic)
9191
Errored(Dynamic)
9292
}
93+
94+
external fn get_start_arguments() -> List(Charlist) =
95+
"init" "get_plain_arguments"
96+
97+
/// Get the arguments given to the program when it was started.
98+
///
99+
/// This is sometimes called `argv` in other languages.
100+
pub fn start_arguments() -> List(String) {
101+
get_start_arguments()
102+
|> list.map(charlist.to_string)
103+
}

0 commit comments

Comments
 (0)