gitops

package module
v0.0.0-...-e8b58ab Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2025 License: MIT Imports: 14 Imported by: 0

README

GitOps

gitops is a cli for generating and pushing git patches to a git repository.

# Edit file using sed
gitops format-patch https://example.com/somerepo.git#path/to/file.txt \
  --sed 's|^version=".*"$|version="v2"|' \
  --message 'update version to v2' \
  --out file.patch

# Edit file using yq
gitops format-patch https://example.com/somerepo.git#path/to/file.yaml \
  --yq '.a.b.c = "v2"' \
  --message 'update version to v2' \
  --out file.patch

# Edit file using jq
gitops format-patch https://example.com/somerepo.git#path/to/file.json \
  --jq '.a.b.c = "v2"' \
  --message 'update version to v2' \
  --out file.patch

# Override file with input file
gitops format-patch https://example.com/somerepo.git#path/to/file.txt \
  --file file.txt \
  --message 'update version to v2' \
  --out file.patch

# Push patch file to remote repo
gitops push-patch https://example.com/somerepo.git \
  --patch file.patch

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenPatch

func GenPatch(url, file string, patch PatchHandler, out io.Writer, message string) error

func ParseCompositeURL

func ParseCompositeURL(u string) (string, string)

func PushPatch

func PushPatch(url, patch string) error

Types

type CommandErr

type CommandErr struct {
	Command string
	Err     error
	Stderr  string
}

func (CommandErr) Error

func (err CommandErr) Error() string

type JqPatchHander

type JqPatchHander struct {
	Filter string
}

func JqPatch

func JqPatch(filter string) JqPatchHander

func (JqPatchHander) Patch

func (h JqPatchHander) Patch(in io.Reader, out io.Writer) error

type PatchHandler

type PatchHandler interface {
	Patch(in io.Reader, out io.Writer) error
}

type ReplacePatchHandler

type ReplacePatchHandler struct {
	LocalFile string
}

func ReplacePatch

func ReplacePatch(path string) ReplacePatchHandler

func (ReplacePatchHandler) Patch

func (h ReplacePatchHandler) Patch(_ io.Reader, out io.Writer) error

type SedPatchHandler

type SedPatchHandler struct {
	Commands []string
}

func SedPatch

func SedPatch(cmds []string) SedPatchHandler

func (SedPatchHandler) Patch

func (h SedPatchHandler) Patch(in io.Reader, out io.Writer) error

type YqPatchHander

type YqPatchHander struct {
	Filter string
}

func YqPatch

func YqPatch(filter string) YqPatchHander

func (YqPatchHander) Patch

func (h YqPatchHander) Patch(in io.Reader, out io.Writer) error

Directories

Path Synopsis
cmd
gitops command

Jump to

Keyboard shortcuts

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