merge

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package merge orchestrates create-or-merge operations with interactive confirmation and marker-based content updates.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateOrMerge

func CreateOrMerge(cmd *cobra.Command, p entity.MergeParams) (bool, error)

CreateOrMerge handles the common pattern of creating a new file or merging ctx content into an existing one.

Parameters:

  • cmd: Cobra command for output and input
  • p: Merge parameters

Returns:

  • created: True if the file was created fresh (no existing file)
  • error: Non-nil if file operations fail

func DeduplicatePermissions

func DeduplicatePermissions(slice *[]string) bool

DeduplicatePermissions removes duplicate and redundant FQ-form permissions.

Parameters:

  • slice: Permissions slice to deduplicate

Returns:

  • bool: True if any duplicates were removed

func Permissions

func Permissions(slice *[]string, defaults []string) bool

Permissions adds default permissions that are not already present.

Parameters:

  • slice: Existing permissions slice to modify
  • defaults: Default permissions to merge in

Returns:

  • bool: True if any permissions were added

func SettingsPermissions

func SettingsPermissions(cmd *cobra.Command) error

SettingsPermissions merges ctx permissions into settings.local.json.

Parameters:

  • cmd: Cobra command for output

Returns:

  • error: Non-nil if file operations fail

func UpdateMarkedSection

func UpdateMarkedSection(
	cmd *cobra.Command,
	filename, existing string,
	newTemplate []byte,
	markerStart, markerEnd string,
) error

UpdateMarkedSection replaces content between start/end markers in a file.

Creates a timestamped backup before writing. If the end marker is missing, replaces it from the start marker to the end of the file.

Parameters:

  • cmd: Cobra command for output
  • filename: Path to the file being updated
  • existing: Current file content
  • newTemplate: New template content (must contain both markers)
  • markerStart: Opening marker string
  • markerEnd: Closing marker string

Returns:

  • error: Non-nil if markers are missing or file operations fail

Types

This section is empty.

Jump to

Keyboard shortcuts

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