base

package
v0.0.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 5, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultBuilderData   = "main.json"
	DefaultBuilderPath   = ".builder"
	DefaultBuilderRunner = "main.go"
)
View Source
const (
	CmdDescription = "Generate documentation for the project that based on iris web framework"
	CmdName        = "gen:doc"
)
View Source
const (
	OptBaseDir            = "base-dir"
	OptBaseDirA           = 'b'
	OptBaseDirDefault     = "./"
	OptBaseDirDescription = "Application base directory"
)
View Source
const (
	OptControllerPath        = "controller-path"
	OptControllerPathA       = 'c'
	OptControllerPathDefault = "app/controllers"
	OptControllerPathDesc    = "Controller files location"
)
View Source
const (
	OptOutputPath            = "output-path"
	OptOutputPathA           = 'o'
	OptOutputPathDefault     = "docs/api"
	OptOutputPathDescription = "Generated markdown files exported to"
)
View Source
const (
	OptOutputFormat            = "output-format"
	OptOutputFormatA           = 'f'
	OptOutputFormatDescription = "Which format documents to export, accept one of"
)

Variables

View Source
var (
	RegexScanEntityName = regexp.MustCompile(`^[a-zA-Z]`)
	RegexScanEntityFile = regexp.MustCompile(`\.go$`)
	RegexScanModuleName = regexp.MustCompile(`module\s+([^\n]+)`)
)
View Source
var (
	// RegexScannerIsComment like follows.
	//
	//   - //
	//   - // content
	RegexScannerIsComment = regexp.MustCompile(`^/{2,}(.*)`)

	// RegexScannerIsComment1 like follows.
	//
	//   - * content
	RegexScannerIsComment1 = regexp.MustCompile(`^\*\s?`)

	// RegexScannerIsComment2 like follows.
	//
	//   - /*
	RegexScannerIsComment2 = regexp.MustCompile(`^/\*+?`)

	// RegexScannerIsComment3 like follows.
	//
	//   - */
	RegexScannerIsComment3 = regexp.MustCompile(`\*/$`)

	RegexScannerMatchAnnotation       = regexp.MustCompile(`^\s*@([a-zA-Z][_a-zA-Z0-9]*)\s*$`)
	RegexScannerMatchAnnotationValues = regexp.MustCompile(`^\s*@([a-zA-Z][_a-zA-Z0-9]*)\s*\(([^)]*)\)\s*$`)

	RegexScannerMatchAction            = regexp.MustCompile("^([A-Z][a-z]*)([A-Z]*[a-zA-Z0-9]*)$")
	RegexScannerMatchCommentCode       = regexp.MustCompile("`([^`]*)`")
	RegexScannerMatchCommentPre        = regexp.MustCompile(`^\s+`)
	RegexScannerMatchCommentDotEnds    = regexp.MustCompile(`\.+$`)
	RegexScannerMatchCommentTableStart = regexp.MustCompile(`^\t`)

	RegexScannerMatchMainFunc = regexp.MustCompile(`^func\s+main\s*\(\s*\)\s*\{`)

	// RegexScannerMatchPackage like follows.
	//
	//   - package main
	//   - package controllers
	RegexScannerMatchPackage = regexp.MustCompile(`^package\s+(\S+)$`)

	// RegexScannerMatchFunc like follows.
	//
	//   func (c *Controller) Post(ctx iris.Context) {
	RegexScannerMatchFunc = regexp.MustCompile(`^func\s*\(\s*[_a-zA-Z0-9]*\s*\*?([A-Z][_a-zA-Z0-9]*)\s*\)\s*([A-Z][_a-z0-9A-Z]*)\s*\(`)

	// RegexScannerMatchStruct like follows.
	//
	//   type Controller struct {
	//       ...
	//   }
	RegexScannerMatchStruct = regexp.MustCompile(`^type\s+([A-Z][_a-zA-Z0-9]*)\s+struct\s*\{`)

	// RegexScannerMatchStructGroup like follows.
	//
	//   var (
	//       Controller struct {
	//           ...
	//       }
	//   )
	RegexScannerMatchStructGroup = regexp.MustCompile(`^([A-Z][_a-zA-Z0-9]*)\s*struct\s*\{`)
)
View Source
var (
	Output console.Output
)
View Source
var (
	RegexActionMatchUpper = regexp.MustCompile(`([A-Z])`)
)

Functions

This section is empty.

Types

type Format

type Format string

Format is a type name that represents the output documents format.

const (
	FormatHtml     Format = "html"
	FormatMarkdown Format = "md"

	// DefaultFormat
	// is the default format if not specified.
	DefaultFormat = FormatMarkdown
)

func (Format) Accepts

func (o Format) Accepts() []string

Accepts returns a list of accepted formats.

func (Format) IsHtml

func (o Format) IsHtml() bool

IsHtml returns true if the format is html.

func (Format) IsMarkdown

func (o Format) IsMarkdown() bool

IsMarkdown returns true if the format is markdown.

func (Format) String

func (o Format) String() string

String returns an accepted format name.

func (Format) Strings

func (o Format) Strings() string

Strings returns an accepted formats string that mixed with comma.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL