Skip to content

lovung/wrappergen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wrapper Generator

Wrapper Generator is a tool written in Golang that generates wrapper code for specified interfaces in a given Go package.

Installation

To install the Wrapper Generator, run the following command:

go install github.com/lovung/wrappergen

Usage

wrappergen [flags]

Flags

  • -package_path: Package path (default is the current working directory).
  • -wrapper_prefix: Prefix to be added to generated wrapper types.
  • -wrapper_suffix: Suffix to be added to generated wrapper types (default is "Wrapper").
  • -custom_code: Custom code to be inserted into generated wrapper methods.
  • -custom_imports: Custom imports to be added to the generated wrapper file.
  • -exclude_files: Comma-separated list of file names to ignore during generation.
  • -exclude_interfaces: Comma-separated list of interface names to ignore during generation.

Environment Variables

  • CUSTOM_CODE: Set the custom code using this environment variable.
  • CUSTOM_IMPORTS: Set the custom imports using this environment variable.

Examples

Generate wrappers for all interfaces in the current package:

wrappergen

Generate wrappers for interfaces with custom code and imports:

wrappergen -custom_code="log.Println(\"Custom code here\")" -custom_imports="fmt"

Generate wrappers excluding specific files and interfaces:

wrappergen -exclude_files="file1.go,file2.go" -exclude_interfaces="Interface1,Interface2"

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Generate the wrapper for all methods of the interfaces with custom code in the current package

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages