donut

package module
v0.0.6-0...-54866c9 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 22 Imported by: 0

README

donut

Tiny dotfiles management tool written in Go.

Installation

Homebrew

brew install nishikirb/tap/donut

source

go install github.com/nishikirb/donut/cmd/donut@latest

Usage

  1. Creating a configuration file.
    The configuration file will be created at $HOME/.config/donut/donut.toml.
donut init
  1. Move your dotfiles to the directory managed by donut (default: $HOME/.local/share/donut).
git clone your/dotfiles.git ~/.local/share/donut
  1. Check the list and changes of files managed by donut.
donut list  // displays the list of files
donut diff  // displays the changes between source and destination files
  1. Handle the changes between source and destination files.
donut apply // apply the changes
donut merge // merge the changes with merge tool

Configuration

The configuration file donut.toml can be placed in the following locations:

  • $XDG_CONFIG_HOME
  • $XDG_CONFIG_HOME/donut
  • $HOME/.config
  • $HOME/.config/donut
Configuration Options
# 'source' is the source directory containing the files that will be managed.
source = '$HOME/.local/share/donut'
# 'destination' is the directory where the files will be applied.
destination = '$HOME'
# 'editor' is the command or executable to be used as the text editor.
editor = ["vim"]
# 'pager' is the command or executable to be used as the pager for viewing file differences.
pager = ["less", "-R"]
# 'diff' is the command or executable to be used for displaying differences between files.
diff = ["diff", "-upN", "{{.Destination}}", "{{.Source}}"]
# 'merge' is the command or executable to be used for merging file changes.
merge = ["nvim", "-d", "{{.Destination}}", "{{.Source}}"]
# 'excludes' is a list of files or directories to be excluded from management.
excludes = []

You can modify these configuration options according to your needs in the configuration file. Ensure that the paths and commands are correctly set to match your system.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetVersion

func GetVersion() string

func SetVersion

func SetVersion(v string)

Types

type App

type App struct {
	// contains filtered or unexported fields
}

func NewApp

func NewApp(opts ...Option) *App

func (*App) AddOptions

func (a *App) AddOptions(opts ...Option) *App

func (*App) ApplyOptions

func (a *App) ApplyOptions() error

func (*App) Run

func (a *App) Run(ctx context.Context, command string, args []string, flags *pflag.FlagSet) error

type Entry

type Entry struct {
	Path    string      `json:"-"`
	Empty   bool        `json:"empty"`
	Mode    fs.FileMode `json:"mode"`
	ModTime time.Time   `json:"mod_time"`
	// contains filtered or unexported fields
}

func NewEntry

func NewEntry(path string) (*Entry, error)

func (*Entry) GetContent

func (e *Entry) GetContent() ([]byte, error)

func (*Entry) GetSum

func (e *Entry) GetSum() ([]byte, error)

func (*Entry) MarshalJSON

func (e *Entry) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (*Entry) UnmarshalJSON

func (e *Entry) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler interface.

type EntryCache

type EntryCache struct {
	// contains filtered or unexported fields
}

func (*EntryCache) Get

func (c *EntryCache) Get(path string) (*Entry, error)

func (*EntryCache) GetSum

func (c *EntryCache) GetSum(path string) ([]byte, error)

func (*EntryCache) Reload

func (c *EntryCache) Reload(path string) (*Entry, error)

func (*EntryCache) Set

func (c *EntryCache) Set(path string, f *Entry)

type Option

type Option func(*App) error

func WithConfig

func WithConfig(c *config.Config) Option

func WithConfigLoader

func WithConfigLoader(opts ...config.ConfigOption) Option

func WithErr

func WithErr(w io.Writer) Option

func WithIn

func WithIn(r io.Reader) Option

func WithOut

func WithOut(w io.Writer) Option

type PathMapper

type PathMapper struct {
	Mapping []PathMapping
	// contains filtered or unexported fields
}

func NewPathMapper

func NewPathMapper(s, d string, funcs ...PathMapperOption) (*PathMapper, error)

func (*PathMapper) RelSourcePaths

func (m *PathMapper) RelSourcePaths() []string

type PathMapperOption

type PathMapperOption func(m *PathMapper)

func WithExcludes

func WithExcludes(s ...string) PathMapperOption

type PathMapping

type PathMapping struct {
	Source      string
	Destination string
}

Directories

Path Synopsis
cmd
test

Jump to

Keyboard shortcuts

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