TBXark / mweb-export

A tool for generating directories from MWeb files.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mweb-export

Build Release

用于生成 Mweb git备份 README 目录文件的工具, MWeb可以使用iCloud备份https://zh.mweb.im/mweb4qa.html,同时可以将~/Library/Containers/com.coderforart.MWeb3/Data/Library/Application Support/MWebLibrary使用git备份到github,但是实际使用中,备份到github之后文件夹结构没有了,文件名也变成了UUID。完全没有可读性。 所以mweb-export就是一个解析Mweb数据库并生成一个包含整个目录结构和索引跳转的README文件。

Install

Go

go install github.com/TBXark/mweb-export@latest

Brew

brew install --build-from-source tbxark/repo/mweb-export

Usage

Usage of mweb-export:
  -help
    	show usage
  -mode string
    	'file': save file, 'debug': print only (default "debug")
  -path string
    	path to MWebLibrary (default "~/Library/Containers/com.coderforart.MWeb3/Data/Library/Application Support/MWebLibrary")
  -target string
    	export README.md directory (default "$(pwd)")

实际使用中不推荐直接在MWebLibrary原始文件夹中使用git,避免多台设备同步git与iCloud发生冲突,可以另外新建新建一个git文件夹,在git目录下添加下面脚本,需要同步的时候执行下面脚本,会自动将MWebLibrary拷贝到git文件夹,并生成README.md文件并且自动push

#!/bin/bash

git stash --include-untracked
git pull
/bin/rm -rf docs # 删除所有文件,重新拷贝,避免有已删除的文件继续留在git
/bin/rm -f mainlib.db
/bin/rm -rf metadata
cp ~/Library/Containers/com.coderforart.MWeb3/Data/Library/Application\ Support/MWebLibrary/mainlib.db mainlib.db
cp -R ~/Library/Containers/com.coderforart.MWeb3/Data/Library/Application\ Support/MWebLibrary/docs docs
cp -R ~/Library/Containers/com.coderforart.MWeb3/Data/Library/Application\ Support/MWebLibrary/metadata metadata
mweb-export -mode=save
git add .
git commit -a -m $(date -u +%Y-%m-%dT%H:%M:%SZ)
git push origin master
git stash clear

About

A tool for generating directories from MWeb files.


Languages

Language:Go 87.3%Language:Makefile 12.7%