copyfiles

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package copyfiles copies gitignored local files (e.g. .env) from the main worktree into a linked worktree, since git worktrees do not include gitignored files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Sync

func Sync(patterns []string, srcRoot, dstRoot string) ([]string, error)

Sync copies every file matching patterns from srcRoot into dstRoot, preserving each match's path relative to srcRoot, and returns the relative paths it copied. Patterns are globs relative to srcRoot (e.g. ".env", ".env.*", "config/local.yml"). It never overwrites a file that already exists in dstRoot, skips directories and matches that escape srcRoot, and is a no-op when srcRoot and dstRoot are the same directory (the main worktree).

func UpsertEnv

func UpsertEnv(path string, vars map[string]string, create bool) ([]string, error)

UpsertEnv sets each key in vars to its value in the dotenv file at path, replacing an existing assignment (correcting a value copied from elsewhere) or appending the key if absent, while leaving every other line and comment untouched. isola uses it so a worktree's env file carries that worktree's resolved env (accessory URLs, etc.), for tools that read the file directly rather than the process environment. If the file does not exist: when create is true it is created (with the given vars), otherwise it is a no-op (returns no keys). Returns the keys changed.

Types

This section is empty.

Jump to

Keyboard shortcuts

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