https://github.com/bcaldwell/dfm
An easy way to manage dotfiles
https://github.com/bcaldwell/dfm
dfm dotfiles go managing-dotfiles
Last synced: 29 days ago
JSON representation
An easy way to manage dotfiles
- Host: GitHub
- URL: https://github.com/bcaldwell/dfm
- Owner: bcaldwell
- License: mit
- Created: 2017-01-06T16:02:55.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2022-05-16T17:23:38.000Z (about 4 years ago)
- Last Synced: 2024-04-14T13:13:09.255Z (about 2 years ago)
- Topics: dfm, dotfiles, go, managing-dotfiles
- Language: Go
- Homepage: https://bcaldwell.ca/dfm/
- Size: 4.25 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# dfm
[](https://goreportcard.com/report/github.com/bcaldwell/dfm) [](https://codebeat.co/projects/github-com-bcaldwell-dfm)
[](https://travis-ci.org/bcaldwell/dfm)
dfm is a tool for managing dotfiles. dfm works best when using git to manage dotfile but will also work without.
## Table of Contents
* [dfm](#dfm)
* [Table of Contents](#table-of-contents)
* [Installation](#installation)
* [Install script](#install-script)
* [Manual Install](#manual-install)
* [Yaml configuration file](#yaml-configuration-file)
* [Usage](#usage)
* [Commands](#commands)
* [install](#install)
* [update](#update)
* [upgrade](#upgrade)
* [git](#git)
* [path](#path)
* [Flags](#flags)
* [config](#config)
* [verbose](#verbose)
* [dryrun](#dryrun)
* [overwrite](#overwrite)
* [force](#force)
* [Enable cd command](#enable-cd-command)
## Installation
### Install script
```
curl -o- https://raw.githubusercontent.com/bcaldwell/dfm/master/scripts/install.sh | bash
```
### Manual Install
Download the applicable binary from [releases](https://github.com/bcaldwell/dfm/releases)
## Yaml configuration file
### Example
```
---
# remote location of repository [optional]
repo: git@github.com:bcaldwell/dotfiles.git
# Links occur fron srcDir/path to destDir/path
# location of source files. Defaults to $HOME/.dotfiles
srcDir: /Home/user/.dotfiles
# default location to link files relatively to. Defaults to $HOME
destDir: /home/user
# Tasks to run
tasks:
name:
# Parameter to run the task
when:
# runs tasks when os matches
os: darwin
# runs the shell command and runs the task if exit code is 0
condition: "echo"
# runs when the text after install matchs Ex: dfm install darwin
parameter "darwin"
# Runs if command doesnt exists in the shell
notInstalled: "brew"
# commands to run
cmd:
- "brew install"
# Links to create
links:
- gitconfig:.gitconfig
# task dependencies
deps:
- depend
```
## Usage
### Commands
##### install
Process each tasks and excuses it
```
dfm install
```
##### update
To use git to update the repository by running `git fetch && git pull` run:
```
dfm update
```
##### upgrade
Same as `dfm update` but runs `dfm install` afterwards:
```
dfm upgrade
```
##### git
Runs the passed in git command in the source respository:
```
dfm git args
```
Ex: `dfm git status`
##### path
Returns the path of the source respository. Useful for `cd`
```
cd $(dfm cd)
```
### Flags
##### config
Sets the location of the configuration file
```
dfm -config pathtoconfig/config.yml
```
##### verbose
Enables verbose logging
```
dfm -verbose install
```
##### dryrun
Prints shell commands that would be excused without excusing them
```
dfm -dryrun install
```
##### overwrite
Overwrite previously existing files, folders or symlinks when linking files
```
dfm -overwrite install
```
##### force
Forces commands to run with more power. Also overwrites previously existing files, folders or symlinks when linking files
```
dfm -force install
```
### Enable cd command
To enable the `dfm cd` command, add the following to your profile (~/.bash_profile, ~/.zshrc, ~/.profile, or ~/.bashrc).
```
function dfm () {
if [ "$1" == "cd" ]
then
cd $(command dfm path)
return 0
fi
command dfm "$@"
}
```