Documentation
¶
Overview ¶
Package merge orchestrates create-or-merge operations with interactive confirmation and marker-based content updates.
Index ¶
- func CreateOrMerge(cmd *cobra.Command, p entity.MergeParams) (bool, error)
- func DeduplicatePermissions(slice *[]string) bool
- func Permissions(slice *[]string, defaults []string) bool
- func SettingsPermissions(cmd *cobra.Command) error
- func UpdateMarkedSection(cmd *cobra.Command, filename, existing string, newTemplate []byte, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateOrMerge ¶
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 ¶
DeduplicatePermissions removes duplicate and redundant FQ-form permissions.
Parameters:
- slice: Permissions slice to deduplicate
Returns:
- bool: True if any duplicates were removed
func Permissions ¶
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 ¶
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.