Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eternal-flame-ad/go-termux
termux api wrappers for golang
https://github.com/eternal-flame-ad/go-termux
android android-api golang termux termux-api
Last synced: 3 months ago
JSON representation
termux api wrappers for golang
- Host: GitHub
- URL: https://github.com/eternal-flame-ad/go-termux
- Owner: eternal-flame-AD
- License: apache-2.0
- Created: 2018-11-15T04:42:23.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-03-20T20:22:54.000Z (almost 3 years ago)
- Last Synced: 2024-06-21T18:49:10.560Z (7 months ago)
- Topics: android, android-api, golang, termux, termux-api
- Language: Go
- Size: 34.2 KB
- Stars: 8
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-termux
[![API Documentation](https://img.shields.io/badge/api-GoDoc-blue.svg?style=flat-square)](https://godoc.org/github.com/eternal-flame-AD/go-termux)
Golang wrapper for termux:API. This package calls termux:API methods directly so that this package would work without termux-api package installed.
## Examples
### Acquires the current battery percentage
```golang
package mainimport (
"fmt"tm "github.com/eternal-flame-AD/go-termux"
)func main() {
if stat, err := tm.BatteryStatus(); err != nil {
panic(err)
} else {
fmt.Printf("The current battery percentage is %d%%.\n", stat.Percentage)
}
}
```### Sets current clipboard content
```golang
package mainimport tm "github.com/eternal-flame-AD/go-termux"
func main() {
if err := tm.ClipboardSet("ummmm"); err != nil {
panic(err)
}
}
```### Displays a short toast
```golang
package mainimport (
tm "github.com/eternal-flame-AD/go-termux"
)func main() {
if err := tm.Toast("Hello World!", tm.ToastOption{
FontColor: "#FF0000",
Position: tm.Top,
Short: true,
BGColor: "#00FF00",
}); err != nil {
panic(err)
}
}
```