dfi

command module
v0.0.0-...-2f3f802 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

README

The purpose of this utility is to keep configuration files and directories under source control in a single directory, then symlink them into place. This is useful for lightweight deployments of personal dev environment settings, and for keeping them in sync.

dfi is written in classic UNIX style, in that it takes a list of files, a destination, and creates symlinks, that's all.

$HOME/
  .settings/
    dotfiles/
      bashrc
      bash_profile
      zshrc
      ssh/
        config

if you run dfi --prefix=. .settings/dotfiles/* ./ in your home directory, it will create the following symlinks:

$HOME/
  .bashrc -> .settings/dotfiles/bashrc
  .bash_profile -> .settings/dotfiles/bash_profile
  .zshrc -> .settings/dotfiles/zshrc
  .ssh -> .settings/dotfiles/ssh

Additionally, it can install links under a bin directory, where the . prefix is not applied. This is useful when you have a number of shell scripts and want to link them from your version controllled directory into a location in your PATH.

Given:

$HOME/
  .settings/
    bin/
      foo
      bar
      baz

In your HOME directory, if you run dfi .settings/bin/* .local/bin/, will result in the following links being created.

$HOME/
  .local/
    bin/
      foo -> ../../.settings/bin/foo
      bar -> ../../.settings/bin/bar
      baz -> ../../.settings/bin/baz

In the case of conflicts (i.e. destination already exists) you can decide how files and symlinks will be handled.

If a link path already exists, the following strategies are available:

  • rename: move the file to a unique dated location and create the symlink

  • replace: just delete the file and create the symlink

  • warn: print a warning that the conflict exists and continue.

  • fail: stop processing and report an error.

Note that dfi will never replace a directory (i.e. rm -rf it), rather that is treated as an error and execution will halt with a non-zero return code.

Documentation

Overview

Copyright © 2020 Jonathan Simms <slyphon@gmail.com>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Directories

Path Synopsis
internal
pkg

Jump to

Keyboard shortcuts

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