rewrite

package
v0.0.0-...-3196316 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CLIApp = &flowutil.CLIApp{
	Tagline: "Automated Code Fixes",
	App: cli.App{
		Name:    "rewrite",
		Usage:   "The Rewrite Flow rewrites sections of source code matching the query pattern in the Tenets it's run over.",
		Version: "0.0.0",

		Flags: []cli.Flag{
			cli.StringFlag{
				Name:  util.OutputFlg.String(),
				Usage: "File to save found rewrites to.",
			},
			cli.StringFlag{
				Name:  util.FormatFlg.String(),
				Value: "json-pretty",
				Usage: "How to format the results. Possible values are: json, json-pretty.",
			},
			cli.BoolFlag{
				Name:  util.KeepAllFlg.String(),
				Usage: "Keep all rewrites and don't be prompted to confirm each.",
			},
			cli.StringFlag{
				Name:  "dir, d",
				Usage: "Modify a given directory.",
			},
			cli.BoolFlag{
				Name:  "debug",
				Usage: "Display debug messages",
			},
			cli.StringFlag{
				Name:  "dump-comments, c",
				Usage: "Output JSON dump of interactive comments to a given file.",
			},
		},
	},
	Request: rewriteAction,
}
View Source
var DecoratorApp = &flowutil.DecoratorApp{
	App: cli.App{
		Name:  "rewrite",
		Usage: "Replace the decorated node with the new code",
		Flags: []cli.Flag{
			cli.BoolFlag{
				Name:  "replace, r",
				Usage: "replace the decorated node with the new source code",
			},
			cli.BoolFlag{
				Name:  "prepend, p",
				Usage: "prepend the decorated node with the new source code",
			},
			cli.BoolFlag{
				Name:  "append, a",
				Usage: "append the decorated node with the new source code",
			},
			cli.BoolFlag{
				Name:  "line, l",
				Usage: "operate on the entire line instead of the byte offsets",
			},
			cli.BoolFlag{
				Name:  "byte, b",
				Usage: "operate on the byte offsets instead of the entire line",
			},
			cli.BoolFlag{
				Name:  "start-offset, s",
				Usage: "operate on the start offset only",
			},
			cli.BoolFlag{
				Name:  "end-offset, e",
				Usage: "operate on the end offset only",
			},
			cli.BoolFlag{
				Name:  "start-to-end-offset, m",
				Usage: "operate on the start to end offset range",
			},
			cli.StringFlag{
				Name:  "new-file, n",
				Usage: "create a new file",
			},
			cli.IntFlag{
				Name:  "new-file-perm, x",
				Usage: "file permission for new file",
			},
		},
	},
	ConfirmDecorated: decoratorAction,
	SetUserVar: func(v *flowutil.UserVar) {
		v.Set()
	},
	DecoratorUsage:   "[options] <new code>",
	DecoratorExample: `--prepend --line "// new comment on a Golang function`,
}

Functions

func Write

func Write(results []*flowutil.DecoratedResult) error

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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