comments

package
v0.1.48 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package comments provides functionality to add and remove comments to the top of files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsFileType

func ContainsFileType(fileTypes []FileType, fileType FileType) bool

indicates whether the given list of FileTypes contains the given FileType

func FileContentWithoutHeader

func FileContentWithoutHeader(path, token string) (string, error)

FileContentWithoutHeader provides the content of the file with the given path, without the comment block identified by the given token.

func SupportsFile

func SupportsFile(filePath string) bool

indicates whether it is possible to add comments to the file with the given name

func WriteFileWithHeader

func WriteFileWithHeader(path, header, body string) error

WriteFileWithHeader creates a file at the given path containing the given file content (header + body). The header argument should contain only text. This method will transform it into the correct comment format.

Types

type FileType

type FileType string

a file format that we know about, represented as its file extension

func GetFileType

func GetFileType(filePath string) FileType

provides the extension of the given filepath

type Format

type Format struct {
	// contains filtered or unexported fields
}

a comment format known to this app

Jump to

Keyboard shortcuts

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