module
Version:
v1.0.0
Opens a new window with list of versions in this module.
Published: May 31, 2023
License: Apache-2.0
Opens a new window with license information.
README
¶
Libpixiu
Library and tools for pixiu
BindConfig
package main
import (
"fmt"
"github.com/caoyingjunz/pixiulib/config"
)
type Config struct {
Default DefaultOption `yaml:"default"`
}
type DefaultOption struct {
Name string `yaml:"name"`
Age int `yaml:"age"`
}
func main() {
c := config.New()
c.SetConfigFile("./config.yaml")
c.SetConfigType("yaml")
var cfg Config
if err := c.Binding(&cfg); err != nil {
panic(err)
}
fmt.Println(cfg)
}
Code demo
Command
package main
import (
"fmt"
"github.com/caoyingjunz/pixiulib/exec"
)
func main() {
exec := exec.New()
// 确认命令行是否存在
if _, err := exec.LookPath("ls"); err != nil {
panic(err)
}
// 属性
out, err := exec.Command("ls", "-al").CombinedOutput()
if err != nil {
panic(err)
}
fmt.Println(string(out))
}
Code demo
Directories
¶
|
|
examples
|
|
|
|
|
|
|
|
|
|
|
|
Click to show internal directories.
Click to hide internal directories.