donut

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2023 License: MIT Imports: 22 Imported by: 0

README

donut

Tiny dotfiles management tool written in Go.

Installation

Homebrew

brew install gleamsoda/tap/donut

source

go install github.com/gleamsoda/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 can be placed in the following locations:

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

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 added in v0.0.3

func NewApp(opts ...Option) *App

func (*App) AddOptions added in v0.0.3

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

func (*App) ApplyOptions added in v0.0.5

func (a *App) ApplyOptions() error

func (*App) Run added in v0.0.3

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

type FileEntry added in v0.0.2

type FileEntry struct {
	Path    string      `json:"-"`
	Empty   bool        `json:"empty"`
	Mode    fs.FileMode `json:"mode"`
	ModTime time.Time   `json:"mod_time"`

	IsFetched bool `json:"-"`
	// contains filtered or unexported fields
}

func NewFileEntry added in v0.0.2

func NewFileEntry(path string) (*FileEntry, error)

func (*FileEntry) GetContent added in v0.0.2

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

func (*FileEntry) GetSum added in v0.0.2

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

func (*FileEntry) MarshalJSON added in v0.0.2

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

MarshalJSON implements json.Marshaler interface.

func (*FileEntry) UnmarshalJSON added in v0.0.2

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

UnmarshalJSON implements json.Unmarshaler interface.

type FileEntryCache added in v0.0.4

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

func (*FileEntryCache) Get added in v0.0.4

func (c *FileEntryCache) Get(path string) (*FileEntry, error)

func (*FileEntryCache) GetSum added in v0.0.4

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

func (*FileEntryCache) Reload added in v0.0.4

func (c *FileEntryCache) Reload(path string) (*FileEntry, error)

func (*FileEntryCache) Set added in v0.0.4

func (c *FileEntryCache) Set(path string, f *FileEntry)

type Option added in v0.0.3

type Option func(*App) error

func WithConfig

func WithConfig(c *config.Config) Option

func WithConfigLoader added in v0.0.3

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

func WithErr

func WithErr(r io.Writer) Option

func WithIn added in v0.0.3

func WithIn(r io.Reader) Option

func WithOut

func WithOut(r io.Writer) Option

type PathMapper added in v0.0.2

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

func NewPathMapper added in v0.0.2

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

func (*PathMapper) RelSourcePaths added in v0.0.2

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

type PathMapperOption added in v0.0.4

type PathMapperOption func(m *PathMapper)

func WithExcludes

func WithExcludes(s ...string) PathMapperOption

type PathMapping added in v0.0.2

type PathMapping struct {
	Source      string
	Destination string
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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