added server logging to file, added logging and formatting to info and lock commands
This commit is contained in:
@@ -2,23 +2,35 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
"github.com/deranjer/clir"
|
||||
"github.com/imdario/mergo"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
// Create new cli
|
||||
cli := clir.NewCli("Other Args", "A basic example", "v0.0.1")
|
||||
|
||||
// Set long description
|
||||
cli.LongDescription("This app shows positional arguments")
|
||||
|
||||
name := cli.NewSubCommand("name", "Shows your name!")
|
||||
name.Action(func() error {
|
||||
fmt.Printf("The remaining arguments were: %+v\n", name.OtherArgs())
|
||||
return nil
|
||||
})
|
||||
// Run!
|
||||
cli.Run()
|
||||
type Foo struct {
|
||||
Ignore []string
|
||||
B int64
|
||||
}
|
||||
|
||||
func main() {
|
||||
src := Foo{
|
||||
Ignore: []string{"one", "two", "three"},
|
||||
B: 2,
|
||||
}
|
||||
dest := Foo{
|
||||
Ignore: []string{"one", "two", "four", "seven"},
|
||||
}
|
||||
|
||||
mergo.Merge(&dest, src, mergo.WithTransformers())
|
||||
fmt.Println(dest)
|
||||
// Will print
|
||||
// {two 2}
|
||||
}
|
||||
|
||||
func MergeStrings(typ reflect.Type) func(dst, src reflect.Value) error {
|
||||
if typ == reflect.TypeOf([]string{}) {
|
||||
return func(dst, src reflect.Value) error {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user