patch

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cli.Command{
	Name:      "patch",
	Usage:     "Patching of concrete directory",
	ArgsUsage: "[patch] [dir]",
	Flags: []cli.Flag{
		&cli.StringSliceFlag{
			Name:    "param",
			Aliases: []string{"p"},
		},
	},

	Action: func(ctx *cli.Context) error {
		opts := Options{}
		var err error

		opts.Patch = ctx.Args().Get(0)
		if opts.Patch == "" {
			return termui.CliError(ctx, fmt.Errorf("patch is mandatory"))
		}

		opts.Dir = ctx.Args().Get(1)
		if opts.Dir == "" {
			opts.Dir, err = os.Getwd()
			if err != nil {
				return termui.CliError(ctx, fmt.Errorf("cannot use current working dir"))
			}
		}

		opts.Params = excav.StringSliceToParams(ctx.StringSlice("param"))

		err = applyPatch(&opts)
		if err != nil {
			return termui.CliError(ctx, err)
		}

		return nil
	},
}

Functions

This section is empty.

Types

type Options

type Options struct {
	Patch  string
	Dir    string
	Params excav.Params
}

Jump to

Keyboard shortcuts

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