Skip to content

Commit 0760bb2

Browse files
committed
📝 chore: update README generate cli, update readme docs 2
1 parent cbb0274 commit 0760bb2

27 files changed

+108
-48
lines changed

README.md

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
[![Coverage Status](https://coveralls.io/repos/github/gookit/goutil/badge.svg?branch=master)](https://coveralls.io/github/gookit/goutil?branch=master)
88
[![Go Reference](https://pkg.go.dev/badge/github.com/gookit/goutil.svg)](https://pkg.go.dev/github.com/gookit/goutil)
99

10-
💪 Useful utils(**900+**) package for the Go: int, string, array/slice, map, error, time, format, CLI, ENV, filesystem, system, testing and more.
10+
💪 Useful utils(**900+**) package for the Go: int, string, array/slice, map, struct, reflect, error, time, format, CLI, ENV, filesystem, system, testing and more.
1111

1212
> **[中文说明](README.zh-CN.md)**
1313
@@ -109,6 +109,8 @@ dump.Print(somevar, somevar2, ...)
109109

110110
> Package `github.com/gookit/goutil/arrutil`
111111
112+
<details><summary>Click to see functions 👈</summary>
113+
112114
```go
113115
// source at arrutil/arrutil.go
114116
func GetRandomOne[T any](arr []T) T
@@ -192,6 +194,8 @@ func StringsMap(ss []string, mapFn func(s string) string) []string
192194
func TrimStrings(ss []string, cutSet ...string) []string
193195
```
194196

197+
</details>
198+
195199
#### ArrUtil Usage
196200

197201
**check value**:
@@ -485,6 +489,8 @@ Preview:
485489

486490
> Package `github.com/gookit/goutil/envutil`
487491
492+
<details><summary>Click to see functions 👈</summary>
493+
488494
```go
489495
// source at envutil/envutil.go
490496
func VarReplace(s string) string
@@ -529,6 +535,8 @@ func LoadText(text string)
529535
func LoadString(line string) bool
530536
```
531537

538+
</details>
539+
532540
#### ENV Util Usage
533541

534542
**helper functions:**
@@ -693,6 +701,8 @@ runtime.goexit()
693701
694702
Package `fsutil` Filesystem util functions: quick check, create, read and write file. eg: file and dir check, operate
695703
704+
<details><summary>Click to see functions 👈</summary>
705+
696706
```go
697707
// source at fsutil/check.go
698708
func PathExists(path string) bool
@@ -826,6 +836,8 @@ func UpdateContents(filePath string, handleFn func(bs []byte) []byte) error
826836
func CreateSymlink(target, linkPath string) error
827837
```
828838
839+
</details>
840+
829841
830842
#### FsUtil Usage
831843
@@ -892,6 +904,8 @@ func StripComments(src string) string
892904
893905
> Package `github.com/gookit/goutil/maputil`
894906
907+
<details><summary>Click to see functions 👈</summary>
908+
895909
```go
896910
// source at maputil/check.go
897911
func HasKey(mp, key any) (ok bool)
@@ -949,12 +963,16 @@ func SetByPath(mp *map[string]any, path string, val any) error
949963
func SetByKeys(mp *map[string]any, keys []string, val any) (err error)
950964
```
951965
966+
</details>
967+
952968
953969
### Math/Number
954970
955971
> Package `github.com/gookit/goutil/mathutil`
956972
957973
Package `mathutil` provide math(int, number) util functions. eg: convert, math calc, random
974+
<details><summary>Click to see functions 👈</summary>
975+
958976
```go
959977
// source at mathutil/calc.go
960978
func Abs[T comdef.Int](val T) T
@@ -1075,11 +1093,14 @@ func RandIntWithSeed(min, max int, seed int64) int
10751093
func RandomIntWithSeed(min, max int, seed int64) int
10761094
```
10771095
1096+
</details>
1097+
10781098
10791099
### Reflects
10801100
10811101
> Package `github.com/gookit/goutil/reflects`
10821102
1103+
Package `reflects` Provide extends reflection util functions. eg: check, convert, value set, etc.
10831104
<details><summary>Click to see functions 👈</summary>
10841105
10851106
```go
@@ -1155,6 +1176,7 @@ func ValueOf(v any) Value
11551176
11561177
> Package `github.com/gookit/goutil/structs`
11571178
1179+
Package `structs` Provide some extends util functions for struct. eg: tag parse, struct init, value set/get
11581180
<details><summary>Click to see functions 👈</summary>
11591181
11601182
```go
@@ -1493,6 +1515,8 @@ func SubstrCount(s, substr string, params ...uint64) (int, error)
14931515
14941516
> Package `github.com/gookit/goutil/sysutil`
14951517
1518+
<details><summary>Click to see functions 👈</summary>
1519+
14961520
```go
14971521
// source at sysutil/exec.go
14981522
func NewCmd(bin string, args ...string) *cmdr.Cmd
@@ -1569,11 +1593,15 @@ func ChangeUserUidGid(newUID int, newGid int) error
15691593
func ChangeUserUIDGid(newUID int, newGid int) (err error)
15701594
```
15711595
1596+
</details>
1597+
15721598
15731599
### Testing Utils
15741600
15751601
> Package `github.com/gookit/goutil/testutil`
15761602
1603+
<details><summary>Click to see functions 👈</summary>
1604+
15771605
```go
15781606
// source at testutil/buffer.go
15791607
func NewBuffer() *byteutil.Buffer
@@ -1613,12 +1641,16 @@ func NewTestWriter() *TestWriter
16131641
func NewDirEnt(fPath string, isDir ...bool) *fakeobj.DirEntry
16141642
```
16151643
1644+
</details>
1645+
16161646
16171647
### Timex
16181648
16191649
> Package `github.com/gookit/goutil/timex`
16201650
1621-
Provides an enhanced time.Time implementation, and add more commonly used functional methods.
1651+
Provides an enhanced `time.Time` implementation, and add more commonly used functional methods.
1652+
<details><summary>Click to see functions 👈</summary>
1653+
16221654
```go
16231655
// source at timex/check.go
16241656
func IsDuration(s string) bool
@@ -1683,6 +1715,7 @@ func FormatUnixBy(sec int64, layout string) string
16831715
func FormatUnixByTpl(sec int64, template ...string) string
16841716
```
16851717
1718+
</details>
16861719
#### Timex Usage
16871720
16881721
**Create timex instance**

0 commit comments

Comments
 (0)