12 releases

Uses new Rust 2021

0.4.1 Sep 30, 2022
0.4.0 Sep 8, 2022
0.3.5 Sep 3, 2022
0.3.0 Aug 30, 2022
0.2.5 Aug 30, 2022

#65 in Configuration

38 downloads per month

GPL-3.0-or-later

285KB
312 lines

xdm

XXiaoA's dotfiles manager Screenshot

🇨🇳中文

Install

Releases

Download the file from releases

Crates.io

Download from crates.io: cargo install xdm. And remember to add ~/.cargo/bin/ into your $PATH

From source

Clone the source code with git. Then run cargo install --path .. And remember to add ~/.cargo/bin/ into your $PATH

Usage

Run xdm -h for more details

First you should create a yaml file named xdm.yaml (not prerequisite, but recommend).

Then you can run xdm s in a directory which has the yaml file. Xdm will find the xdm.yaml automatically in the current directory. Or you're able to use xdm s file.yaml to specify a yaml file.

Also, you can link a specific a directory or file.

Manual

You can set manual true in your link parameter (see configuration).

If a link is manual, it won't be crated after run xdm s. But you can create it manually:

xdm link {path}

Also, link command can work in all links, whether it'is manual or not.

And you can crate all links with xdm s -a

Add

You can use add command to add a link item into your configuration automatically. For example:

xdm a a

Then the following will add into your configuration:

link:
  # add by xdm
  a:
    path: b

BTW, the link is added is absolutize. And it don't use a simple way: a: b in order to let you add other parameter more easily.

Notice: This feature will change your configuration. Your configuration probably be messy, but it still legal. Maybe fix it in the futrue.

Configuration

For example:

link:
  ./path-to-original-file:
    path: ./path-to-linked-file

  ./nvim: ~/repos/nvim

  ./tmux:
    path: ~/.tmux.conf
    if: test -e /usr/bin/tmux # for fish shell

create:
  - ~/repos

Notice: you must have link option.

Link a file/directory.

What's more, the two following form is same, it can reduce your work:

link:
  ./a:
    path: b

  ./a: b
Parameter Explanation type default
path The file path to linked file string \
exist Only create the link if the original file exists bool true
force Create the link whether the linked file exists or not bool false
if Create the link if shell command is true (WIP) string \
create Create the parent directory of link if need bool true
manual Check here bool false
relink Auto relink if the linked path is a link bool true

Create

Create a directory

Others

Notice

Whether path-to-linked-file is a directory or file, it shouldn't end with /.

But path-to-original-file should end with / or not is base on yourself.

Full example

XXiaoA/dotfiles

License

GNU General Public License v3.0

Dependencies

~4MB
~77K SLoC