Skip to content

Commit

Permalink
Add os.arch and os.platform (#437)
Browse files Browse the repository at this point in the history
* add  and

* .ignore
  • Loading branch information
Lack30 authored Feb 24, 2024
1 parent e9b0393 commit 47062da
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
dist/
dist/

.idea
2 changes: 2 additions & 0 deletions docs/stdlib-os.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ os := import("os")

## Constants

- `platform`
- `arch`
- `o_rdonly`
- `o_wronly`
- `o_rdwr`
Expand Down
3 changes: 3 additions & 0 deletions stdlib/os.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@ import (
"io/ioutil"
"os"
"os/exec"
"runtime"

"github.com/d5/tengo/v2"
)

var osModule = map[string]tengo.Object{
"platform": &tengo.String{Value: runtime.GOOS},
"arch": &tengo.String{Value: runtime.GOARCH},
"o_rdonly": &tengo.Int{Value: int64(os.O_RDONLY)},
"o_wronly": &tengo.Int{Value: int64(os.O_WRONLY)},
"o_rdwr": &tengo.Int{Value: int64(os.O_RDWR)},
Expand Down

0 comments on commit 47062da

Please sign in to comment.