← 全部工具

Tatsh/baldwin

热度 65 更新于 开发与构建

Simple tracking of your home directory with easy-to-read diffs.

githubauto-collected

安装

暂未验证可直接使用的安装命令,请查看项目官方文档或 Release。

Baldwin

This is a conversion of my simple scripts to version my home directory with very specific excludes and formatting every file upon commit so that readable diffs can be generated.

Installation

Pip

pip install baldwin

Usage

 $ bw -h
Usage: bw [OPTIONS] COMMAND [ARGS]...

  Manage a home directory with Git.

Options:
  -d, --debug  Enable debug logging.
  -h, --help   Show this message and exit.

Commands:
  auto-commit
  format

info init install-units


In addition to the `bw` command, `hgit` is a shortcut for `bw git`.

### Start a new repository

bw init


Find out where the Git directory is by running `bw info`. This can be done even if `init` has not
been run.

### Automation

#### systemd

bw install-units


This will install a timer that will automatically make a new commit every 6 hours. It does not push.

Keep in mind that systemd units require a full path to the executable, so you must keep the unit
up-to-date if you move where you install this package. Simply run `bw install-units` again.

Note that user systemd units only run while logged in.

To disable and remove the units, use the following commands:

systemctl disable --now home-vcs.timer rm ~/.config/systemd/user/home-vcs.


### Pushing

To push, use either of the following:

- `bw git push`
- `hgit push`

The above also demonstrates that `bw git`/`hgit` are just frontends to `git` with the correct
environment applied.

## Formatting

If Prettier is installed, it will be used to format files. The configuration used comes with this package. Having consistent formatting allows for nice diffs to be generated.

If you have initialised a repository without having prettier or jq in PATH, you need to run the following commands to enable readable diffs:

hgit config diff.json.textconv 'jq -MS .'
hgit config diff.json.cachetextconv true
hgit config diff.yaml.textconv 'prettier --no-editorconfig --parser yaml'
hgit config diff.yaml.cachetextconv true