mirror of
https://github.com/DioxusLabs/dioxus
synced 2025-02-17 14:18:27 +00:00
docs: commit docs
This commit is contained in:
parent
d47319526c
commit
1c59c902a6
3 changed files with 85 additions and 1 deletions
|
@ -10,6 +10,8 @@
|
|||
- [Clean](./cmd/clean.md)
|
||||
- [Translate](./cmd/translate.md)
|
||||
- [Plugin Development](./plugin/README.md)
|
||||
- [API.Log](./plugin/interface/log.md)
|
||||
- [API.Command](./plugin/interface/command.md)
|
||||
- [API.OS](./plugin/interface/os.md)
|
||||
- [API.Directories](./plugin/interface/dirs.md)
|
||||
- [API.Directories](./plugin/interface/dirs.md)
|
||||
- [API.Network](./plugin/interface/network.md)
|
48
docs/src/plugin/interface/log.md
Normal file
48
docs/src/plugin/interface/log.md
Normal file
|
@ -0,0 +1,48 @@
|
|||
# Log Functions
|
||||
|
||||
> You can use log function to print some useful log info
|
||||
|
||||
### Trace(info: string)
|
||||
|
||||
Print trace log info
|
||||
|
||||
```lua
|
||||
local log = plugin.log
|
||||
log.trace("trace information")
|
||||
```
|
||||
|
||||
### Debug(info: string)
|
||||
|
||||
Print debug log info
|
||||
|
||||
```lua
|
||||
local log = plugin.log
|
||||
log.debug("debug information")
|
||||
```
|
||||
|
||||
### Info(info: string)
|
||||
|
||||
Print info log info
|
||||
|
||||
```lua
|
||||
local log = plugin.log
|
||||
log.info("info information")
|
||||
```
|
||||
|
||||
### Warn(info: string)
|
||||
|
||||
Print warning log info
|
||||
|
||||
```lua
|
||||
local log = plugin.log
|
||||
log.warn("warn information")
|
||||
```
|
||||
|
||||
### Error(info: string)
|
||||
|
||||
Print error log info
|
||||
|
||||
```lua
|
||||
local log = plugin.log
|
||||
log.error("error information")
|
||||
```
|
34
docs/src/plugin/interface/network.md
Normal file
34
docs/src/plugin/interface/network.md
Normal file
|
@ -0,0 +1,34 @@
|
|||
# Network Functions
|
||||
|
||||
> you can use Network functions to download & read some data from internet
|
||||
|
||||
### download_file(url: string, path: string) -> boolean
|
||||
|
||||
This function can help you download some file from url, and it will return a *boolean* value to check the download status. (true: success | false: fail)
|
||||
|
||||
You need pass a target url and a local path (where you want to save this file)
|
||||
|
||||
```lua
|
||||
-- this file will download to plugin temp directory
|
||||
local status = plugin.network.download_file(
|
||||
"http://xxx.com/xxx.zip",
|
||||
plugin.dirs.temp_dir()
|
||||
)
|
||||
if status != true then
|
||||
log.error("Download Failed")
|
||||
end
|
||||
```
|
||||
|
||||
### clone_repo(url: string, path: string) -> boolean
|
||||
|
||||
This function can help you use `git clone` command (this system must have been installed git)
|
||||
|
||||
```lua
|
||||
local status = plugin.network.clone_repo(
|
||||
"http://github.com/mrxiaozhuox/dioxus-starter",
|
||||
plugin.dirs.bin_dir()
|
||||
)
|
||||
if status != true then
|
||||
log.error("Clone Failed")
|
||||
end
|
||||
```
|
Loading…
Add table
Reference in a new issue