added server logging to file, added logging and formatting to info and lock commands

This commit is contained in:
2020-06-09 23:22:07 -04:00
parent 441a9ed233
commit 161843f4c8
15 changed files with 126 additions and 66 deletions

View File

@@ -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 {
}
}
}