Documentation ¶
Index ¶
- func AppendFile(filename string) *os.File
- func CreateFile(filename string) *os.File
- func PackageAndFuncs(files ...string) (string, []string)
- func PackageAndStructs(files ...string) (string, []string)
- func Parse(files ...string) (*ast.File, error)
- func SnakeCase(camelCase string) string
- func UseCobra(root *ast.File) bool
- type Source
- type Struct
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendFile ¶ added in v1.1.11
func CreateFile ¶ added in v1.1.11
func PackageAndFuncs ¶
PackageAndFuncs 解析Go源程序包和方法.
func PackageAndStructs ¶ added in v1.1.11
Types ¶
type Source ¶ added in v1.1.12
func NewSource ¶ added in v1.1.12
Example ¶
ExampleNewSource is an example function.
package main import ( "fmt" "github.com/xuender/go-cli/utils" ) func main() { source, err := utils.NewSource("source.go") fmt.Println(err) fmt.Println(source.Funcs) fmt.Println(source.Structs[0].FieldNames) }
Output: <nil> [Struct_String NewStruct NewSource] [Package Funcs Structs]
Click to show internal directories.
Click to hide internal directories.