headers

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const COMPANY_NAME = "Ory Corp"
View Source
const COPY_HEADER_TEMPLATE = "AUTO-GENERATED, DO NOT EDIT!\nPlease edit the original at %s"

template for the header

View Source
const HEADER_REGEXP = HEADER_TOKEN + `\s+(\d{4})\s+` + COMPANY_NAME
View Source
const HEADER_TEMPLATE_OPEN_SOURCE = HEADER_TOKEN + " %d " + COMPANY_NAME + "\nSPDX-License-Identifier: Apache-2.0"

HEADER_TEMPLATE_OPEN_SOURCE defines the full header text for open-source files.

View Source
const HEADER_TEMPLATE_PROPRIETARY = HEADER_TOKEN + " %d " + COMPANY_NAME + "\nProprietary and confidential.\nUnauthorized copying of this file is prohibited."

HEADER_TEMPLATE_PROPRIETARY defines the full header text for proprietary files.

View Source
const HEADER_TOKEN = "Copyright ©"

HEADER_TOKEN defines a text snippet to recognize an existing copyright header in a file.

View Source
const ROOT_PATH = "https://github.com/ory/meta/blob/master/"

the root path for links to the original NOTE: might have to convert to a CLI switch

Variables

View Source
var Main = &cobra.Command{
	Use:   "headers",
	Short: "Adds language-specific headers to files",
}

Functions

func AddHeaders added in v0.1.48

func AddHeaders(dir string, headerText string, exclude []string, headerRegexp *regexp.Regexp) error

AddHeaders adds or updates the Ory copyright header in all applicable files within the given directory. Skips the file if any existing headers match `headerRegexp`

func CopyFile

func CopyFile(src, dst string) error

Header-aware equivalent of the Unix `cp` command. Copies the given source file (path must be relative to CWD) to the given absolute path and prepends the COPY_HEADER_TEMPLATE to the content.

func CopyFileNoOverwrite

func CopyFileNoOverwrite(src, dst string) error

Header-aware equivalent of the Unix `cp -n` command. Copies the given source file (path must be relative to CWD) to the given absolute path if the destination file does not exist and prepends the COPY_HEADER_TEMPLATE to the content.

func CopyFiles

func CopyFiles(src, dst string) error

Header-aware equivalent of the Unix `cp -r` command. Copies all files in the given `src` directory (path must be relative to CWD) to the given absolute path and prepends the COPY_HEADER_TEMPLATE to the content.

Types

This section is empty.

Directories

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

Jump to

Keyboard shortcuts

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