npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@wuxh/backup-cli

v1.9.0

Published

> 备份你的配置文件和目录 [为什么重复创造轮子?](https://github.com/lra/mackup/issues/1849#issuecomment-1369963734),[lra/mackup#1969](https://github.com/lra/mackup/discussions/1969)。

Downloads

26

Readme

@wuxh/backup-cli

备份你的配置文件和目录 为什么重复创造轮子?lra/mackup#1969

npm npm

简体中文 | English | Bilibili#BV1dL411D7kh

安装

npm i @wuxh/backup-cli -g

使用

备份

backup-cli

还原

backup-cli -r

支持的应用程序

backup-cli -l

查看配置

backup-cli -c

CLI 命令

使用 backup-cli -h 查看最新的使用说明:

    npx @wuxh/backup-cli [options]
    ----------------------------------------
    -l, --list: list all apps.
    -f, --force: force to backup (overwrite files).
    -c, --config: view config.
    -r, --restore: restore backup.
    -h, --help: show help.
    -d, --debug: show debug info.
    -v, --version: show version. vx.x.x
    ----------------------------------------
    e.g. backup-cli -h

Config

默认使用 $HOME/.backuprc 作为配置文件,也可以通过设置 BACKUP_CONFIG_FILE 环境变量自定义其他位置。

[storage]
; 备份路径, 默认: 执行命令当前目录
path = $PWD
; 备份目录, 默认: backup
directory = backup

; 同步的应用程序, 默认同步全部
[applications_to_sync]
zsh

; 忽略某一个应用程序, 默认为空
[applications_to_ignore]
git

自定义应用程序

定义 [application name].cfg 配置文件,并放在 $HOME/.backup 根目录中,你可以通过设置 BACKUP_CUSTOM_APP_DIR 环境变量自定义其他目录。

[application]
name = Git

; 要同步的目录或文件, 从 $HOME 开始拼接
[configuration_files]
.gitconfig_work

; XDG 配置文件, 从 $XDG_CONFIG_HOME 开始拼接;
; see: https://specifications.freedesktop.org/basedir-spec/latest
[xdg_configuration_files]
git/config

高级用法

强制还原

backup-cli -r 还原备份时使用 --force 无法强制覆盖文件(还是会进行二次确认)。因为数据是宝贵的,所以默认不会覆盖。

  • tips: 你可以通过设置 BACKUP_FORCE_RESTORE = true 环境变量来强制还原。(还是需要加上 --force 参数)

还原他人的备份

还原备份目录中的文件到 $HOME 目录,但是他人的 $HOME 目录可能和你的不一样,所以不能直接还原。

  • tips: 你可以通过设置 BACKUP_UPSTREAM_HOME={别人的HOME目录} 环境变量来还原他人的备份。

谁在使用

贡献&调试

  1. 克隆项目后使用 pnpm 安装依赖
git clone [email protected]:Wxh16144/backup-cli.git && cd backup-cli \
    && pnpm install

之后可以在 VSCode 中按下 F5 进行 debugger, launch.json

LICENSE

MIT

实现参考