Skip to content

Commit

Permalink
👔 up(cflag,doc): update readme docs, add more tests for cflag
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Feb 25, 2023
1 parent ba0c414 commit c9dcde9
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 26 deletions.
7 changes: 0 additions & 7 deletions README.md
Expand Up @@ -1251,13 +1251,6 @@ func IsMac() bool
func IsDarwin() bool
func IsLinux() bool
func OpenURL(URL string) error
// source at sysutil/sysutil_linux.go
func IsWin() bool
func IsWindows() bool
func IsMac() bool
func IsDarwin() bool
func IsLinux() bool
func OpenURL(URL string) error
// source at sysutil/sysutil_nonwin.go
func Kill(pid int, signal syscall.Signal) error
func ProcessExists(pid int) bool
Expand Down
7 changes: 0 additions & 7 deletions README.zh-CN.md
Expand Up @@ -1252,13 +1252,6 @@ func IsMac() bool
func IsDarwin() bool
func IsLinux() bool
func OpenURL(URL string) error
// source at sysutil/sysutil_linux.go
func IsWin() bool
func IsWindows() bool
func IsMac() bool
func IsDarwin() bool
func IsLinux() bool
func OpenURL(URL string) error
// source at sysutil/sysutil_nonwin.go
func Kill(pid int, signal syscall.Signal) error
func ProcessExists(pid int) bool
Expand Down
10 changes: 0 additions & 10 deletions cflag/ext.go
Expand Up @@ -168,16 +168,6 @@ func NewKVString() KVString {
}
}

// String to string
func (s *KVString) String() string {
return s.SMap.String()
}

// SetData value
func (s *KVString) SetData(mp map[string]string) {
s.SMap = mp
}

// Data map get
func (s *KVString) Data() maputil.SMap {
return s.SMap
Expand Down
13 changes: 13 additions & 0 deletions cflag/ext_test.go
Expand Up @@ -34,3 +34,16 @@ func TestConfString_Set(t *testing.T) {
assert.Eq(t, "inhere", cs.Str("name"))
assert.Eq(t, 123, cs.Int("age"))
}

func TestKVString_Set(t *testing.T) {
kv := cflag.NewKVString()
assert.Empty(t, kv.Data())

assert.NoErr(t, kv.Set("age=234"))
assert.NotEmpty(t, kv.Data())
assert.Eq(t, 234, kv.Int("age"))
assert.Eq(t, "{age:234}", kv.String())

assert.NoErr(t, kv.Set("name=inhere"))
assert.Eq(t, "inhere", kv.Str("name"))
}
8 changes: 6 additions & 2 deletions internal/gendoc/main.go
Expand Up @@ -24,8 +24,6 @@ var (
hidden = []string{
"netutil",
"comdef",
"common",
"numbers",
"internal",
}
nameMap = map[string]string{
Expand Down Expand Up @@ -193,6 +191,12 @@ func collectPgkFunc(ms []string, basePkg string) *bytes.Buffer {
if strings.HasSuffix(filename, "_windows.go") {
continue
}
if strings.HasSuffix(filename, "_darwin.go") {
continue
}
// if strings.HasSuffix(filename, "_linux.go") {
// continue
// }

idx := strings.IndexRune(filename, '/')
dir := filename[:idx] // sub pkg name.
Expand Down

0 comments on commit c9dcde9

Please sign in to comment.