Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Magenta ... Magenta = color.New(color.FgMagenta).FprintfFunc() // Success ... Success = color.New(color.FgGreen).FprintfFunc() // Info ... Info = color.New(color.FgBlue).FprintfFunc() // Warning ... Warning = color.New(color.FgYellow).FprintfFunc() // Error ... Error = color.New(color.FgRed).FprintfFunc() // Log ... Log = color.New(color.FgWhite).FprintfFunc() )
View Source
var ( // PlainText file extensions PlainText = []LanguageID{"txt", "embedme"} // None contains no text file extensions None = []LanguageID{""} // Typescript file extensions Typescript = []LanguageID{"ts"} // Javascript file extensions Javascript = []LanguageID{"js"} // Reason file extensions Reason = []LanguageID{"re"} // Scss file extensions Scss = []LanguageID{"scss"} // Rust file extensions Rust = []LanguageID{"rust"} // Java file extensions Java = []LanguageID{"java"} // Cpp file extensions Cpp = []LanguageID{"cpp"} // C file extensions C = []LanguageID{"c"} // HTML file extensions HTML = []LanguageID{"html"} // XML file extensions XML = []LanguageID{"xml"} // Markdown file extensions Markdown = []LanguageID{"md"} // TOML file extensions TOML = []LanguageID{"toml"} // YAML file extensions YAML = []LanguageID{"yaml"} // JSON file extensions JSON = []LanguageID{"json"} // JSON5 file extensions JSON5 = []LanguageID{"json5"} // Python file extensions Python = []LanguageID{"py", "python"} // Bash file extensions Bash = []LanguageID{"bash"} // Shell file extensions Shell = []LanguageID{"sh", "shell"} // Golang file extensions Golang = []LanguageID{"go", "golang"} // ObjectiveC file extensions ObjectiveC = []LanguageID{"objectivec", "objc"} // PHP file extensions PHP = []LanguageID{"php"} // CSharp file extensions CSharp = []LanguageID{"cs"} // Swift file extensions Swift = []LanguageID{"swift"} // Ruby file extensions Ruby = []LanguageID{"rb"} // Kotlin file extensions Kotlin = []LanguageID{"kotlin"} // Scala file extensions Scala = []LanguageID{"scala"} // Crystal file extensions Crystal = []LanguageID{"cr"} // PlantUML file extensions PlantUML = []LanguageID{"puml"} // Mermaid file extensions Mermaid = []LanguageID{"mermaid"} // Cmake file extensions Cmake = []LanguageID{"cmake"} // Protobuf file extensions Protobuf = []LanguageID{"proto"} // SQL file extensions SQL = []LanguageID{"sql"} // Haskell file extensions Haskell = []LanguageID{"hs"} // Arduino file extensions Arduino = []LanguageID{"ino"} // Jsx file extensions Jsx = []LanguageID{"jsx"} // Tsx file extensions Tsx = []LanguageID{"tsx"} )
View Source
var ( // LanguageComments ... LanguageComments = map[CommentType][]LanguageID{ CommentNone: concat(JSON), CommentDoubleSlash: concat( None, PlainText, C, Typescript, Reason, Javascript, Rust, Cpp, Java, Golang, ObjectiveC, Scss, PHP, CSharp, Swift, Kotlin, Scala, JSON5, Protobuf, Arduino, Jsx, Tsx, ), CommentXML: concat( HTML, Markdown, XML, ), CommentHash: concat( Python, Bash, Shell, YAML, TOML, Ruby, Crystal, Cmake, ), CommentSingleQuote: concat( PlantUML, ), CommentDoublePercent: concat( Mermaid, ), CommentDoubleHyphens: concat( SQL, Haskell, ), } // SupportedLanguages ... SupportedLanguages = buildSupportedLanguages(LanguageComments) // CommentForLanguage ... CommentForLanguage = buildCommentForLanguage(LanguageComments) )
Functions ¶
func FirstComment ¶
func FirstComment(source string, typ CommentType) (string, bool)
FirstComment ...
Types ¶
type CodeBlock ¶
type CodeBlock struct { Start int End int StartLine int EndLine int Indent string Code string EmbedComment string Ignore bool Language LanguageID }
CodeBlock ...
func (*CodeBlock) CommentType ¶
func (b *CodeBlock) CommentType() (*CommentType, error)
CommentType ...
type CommentType ¶
type CommentType uint32
CommentType describes the type of comment used by a programming language
const ( // CommentNone refers to no comment CommentNone CommentType = iota // CommentDoubleSlash refers to "//" comment CommentDoubleSlash // CommentXML refers to "<!-- ... -->" comment CommentXML // CommentHash refers to "#" comment CommentHash // CommentSingleQuote refers to "'" comment CommentSingleQuote // CommentDoublePercent refers to "%%" comment CommentDoublePercent // CommentDoubleHyphens refers to "--" comment CommentDoubleHyphens )
type Embedder ¶
Embedder is the embedder
It is possible to use a custom filesystem implementation.
type Options ¶
type Options struct { StripEmbedComment bool Stdout bool Verify bool DryRun bool WorkingDir string Base string }
Options for embedme
func NewDefaultOptions ¶
func NewDefaultOptions() Options
NewDefaultOptions returns default options for embedme
type SourceMap ¶
SourceMap is a map that tracks if a source path is valid (non-ignored)
func (SourceMap) Ignore ¶
Ignore ignores all sources that match the entries of the Gitignore
Note: Ignore should be called after all sources were added
func (SourceMap) ValidCount ¶
ValidCount counts the number of valid (non-ignored) sources
Click to show internal directories.
Click to hide internal directories.