~jcmuller/tools

A host of command line utilities written to make my life easier

f56a737 chore: update to version 0.0.1

~jcmuller pushed to ~jcmuller/picky git

11 days ago

f56a737 chore: update to version 0.0.1

~jcmuller pushed to ~jcmuller/picky git

11 days ago

#my-dotfiles-manager

Go Report Card MIT Go Reference builds.sr.ht status

This project aims to help users manage their dotfiles with GNU Stow, and to provide a way of dealing with alternate files depending on some criteria, like host name, OS name, Linux distribution ID, or an arbitrary set of classes.25a45e5 Please ensure you have stow installed before moving on.

#About

Your dotfiles repository should be laid down on a per application (or collection of) basis. This helps you keep related files close together without having to figure out what files go with what else.

For example:

~/dotfiles
├── ack
│   └── .ackrc
├── alacritty
│   └── .config
│       └── alacritty
│           ├── alacritty.yml -> alacritty.yml##default
│           ├── alacritty.yml##c.lodpi
│           └── alacritty.yml##default
...

stow will then ensure that those files are available in your home directory:

  • ~/.ackrc -> ~/dotfiles/ackrc/.ackrc
  • ~/.config/alacritty/alacritty.yml -> ~/dotfiles/alacritty/.config/alacritty/alacritty.yml
  • ...

The alternate files we see above were created via mdm alt

A config file is expected to be found in ~/.config/mdm/config.yaml. Its anatomy is:

---
classes:
    - hidpi
    - laptop
    - personal
programs:
    - program-1
    - program-2
    - program-3
root: ~/myrepo
repo: https://github.com/myusername/myrepo.git

You can see what attributes your computer has by running:

$ mdm alt show-attributes
Hostname:     my-hostname
Distribution: my-distro
OS:           my-os
Classes:
  - hidpi
  - laptop
  - personal

You can use these attributes to set up alternate files in your subdirectories.

#Installation

#Via go install

$ go install git.sr.ht/~jcmuller/my-dotfiles-manager/cmd/mdm@latest
go: downloading git.sr.ht/~jcmuller/my-dotfiles-manager v....

Now mdm will be available.

#As a nix flake

$ nix run sourcehut:~jcmuller/my-dotfiles-manager -- --help

#Command line completion

You can install the automated command line completion:

$  mdm completion --help
Generate the autocompletion script for mdm for the specified shell.
See each sub-command's help for details on how to use the generated script.

Usage:
  mdm completion [command]

Available Commands:
  bash        Generate the autocompletion script for bash
  fish        Generate the autocompletion script for fish
  powershell  Generate the autocompletion script for powershell
  zsh         Generate the autocompletion script for zsh

#Commands

  • mdm update: it will fetch and merge the latest changes to the dotfiles repository, then it will run mdm alt and ultimately stow <program> for each program listed in the configuration file.

#Contributing

This project is hosted in sourcehut. man.sr.ht explains everything better than I possibly could.

You can use git send-email to submit patches to ~jcmuller/patches@lists.sr.ht (see this step-by-step guide for more information).

Alternatively, you can push your changes to a public repository, for example hosted on your own Git server, on Sourcehut, Gitlab or GitHub, and use git request-pull to send a pull request to the mailing list.

If these options don’t work for you, just use your mail client to send a mail with a link to your changes and a short description to the mailing list.

#git send-email example

$ git clone https://git.sr.ht/~jcmuller/my-dotfiles-manager && cd my-dotfiles-manager
$ git config format.subjectPrefix "PATCH my-dotfiles-manager"
$ git config sendemail.to "~jcmuller/patches@lists.sr.ht" # see README.md

Once you've made some changes, like

$ echo test > test.txt
$ git add test.txt
$ git commit -m "Test"

Use git send-email to generate a patch for the last commit and to send it to the mailing list:

$ git send-email HEAD^ --annotate