自动生成博客README - Cli
目录:
1、特点
- 生成博客的README文件
- 本人博客使用的
Typora
,所以很容易构建
2、快速开始
1、下载
go get -u -v github.com/anthony-dong/go-tool
2、使用帮助
配置文件来自于 go-tool --config 参数
,所以变更配置文件需要指定这个
➜ go-tool markdown -h
NAME:
markdown - 生成markdown项目的README文件
USAGE:
markdown [command options] [arguments...]
OPTIONS:
--dir value, -d value The markdown project dir
--template value, -t value The markdown template file path, go template struct: &{UrlPath: Total:0}
--ignore value, -i value The markdown template file path of gitignore pattern
--help, -h show help (default: false)
3、简单操作
➜ go-tool --config /Users/fanhaodong/note/note/.config/go-tool.json markdown --dir /Users/fanhaodong/note/note --template /Users/fanhaodong/note/note/.config/README-template.md
[GO-TOOL] 2021/03/03 15:54:40 markdown.go:66: [INFO] Found .gitignore
[GO-TOOL] 2021/03/03 15:54:40 api.go:34: [INFO] [markdown] command load config:
{
"config": "/Users/fanhaodong/note/note/.config/go-tool.json",
"dir": "/Users/fanhaodong/note/note",
"gir_ignore_file": "/Users/fanhaodong/note/note/.gitignore",
"git_ignore_pattern": [],
"log-level": "debug",
"template": "/Users/fanhaodong/note/note/.config/README-template.md"
}
[GO-TOOL] 2021/03/03 15:54:46 markdown.go:108: [INFO] Get ReadmeFileInfo success, UrlPath: Not show, Total: 871
[GO-TOOL] 2021/03/03 15:54:46 markdown.go:116: [INFO] Create /Users/fanhaodong/note/note/README.md file success !!
[GO-TOOL] 2021/03/03 15:54:46 markdown.go:122: [INFO] New parser success, template file: /Users/fanhaodong/note/note/.config/README-template.md
[GO-TOOL] 2021/03/03 15:54:46 markdown.go:127: [INFO] Write README file success !!
4、配置文件
无
5、博客的Makefile文件
博客目录需要有 .config/go-tool.json
文件和 .config/README-template.md
文件
# #######################################################
# Function :Makefile for go #
# Platform :All Linux Based Platform #
# Version :1.0 #
# Date :2021-01-26 #
# Author :fanhaodong516@gmail.com #
# Usage :make #
# #######################################################
# 项目路径
PROJECT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
# =========构建工具========
# BIN 目录
BIN_DIR := $(PROJECT_DIR)/bin
# GO_TOOL 文件
GO_TOOL := $(BIN_DIR)/go-tool
# GO_TOOL 的GIT地址
GO_TOOL_GIT := github.com/anthony-dong/go-tool
# Go 编译的环境,由于依赖于一些google的包,所以需要使用goproxy.io
GO_ENV := GOPROXY="https://goproxy.io,direct" GOBIN="$(BIN_DIR)"
# ===========构建配置文件===========
GO_TOOL_CONFIG_FILE := $(PROJECT_DIR)/.config/go-tool.json
.PHONY: $(GO_TOOL_CONFIG_FILE) all tool upload
all: tool $(GO_TOOL_CONFIG_FILE)
$(GO_TOOL) --config $(GO_TOOL_CONFIG_FILE) markdown --dir $(PROJECT_DIR) --template $(PROJECT_DIR)/.config/README-template.md
tool:
@if [ ! -d $(BIN_DIR) ]; then mkdir -p $(PROJECT_DIR)/bin; fi
@if [ ! -e $(GO_TOOL) ]; then $(GO_ENV) go get -u -v $(GO_TOOL_GIT); fi
$(GO_TOOL_CONFIG_FILE):
-mkdir -p $(shell dirname $(GO_TOOL_CONFIG_FILE))
# ======go-tool upload -f ./README.md -t software -d base64 ==============
UPLOAD :=
ifdef file
UPLOAD := $(UPLOAD) -f $(file)
endif
ifdef type
UPLOAD := $(UPLOAD) -t $(type)
endif
ifdef decode
UPLOAD := $(UPLOAD) -d $(decode)
endif
upload: tool $(GO_TOOL_CONFIG_FILE)
$(GO_TOOL) --config $(GO_TOOL_CONFIG_FILE) upload $(UPLOAD)
clean:
$(RM) -r $(BIN_DIR)
# 个人笔记
## 1、介绍
- 本人所有的笔记都在里面,使用Git仓库作为平台搭建的,为了查询速度,本人添加了文件目录的选项,方便直接查询,合计{{.Total}}篇
- 有可能涉及到工作公司的一些隐私URL,所以这个不会作为public的仓库
- 目前仓库所有文件都是文本,图片上传依赖于本人写的OSS插件配合Typora ,有兴趣的可以下载OSS插件:[https://github.com/Anthony-Dong/go-tool](https://github.com/Anthony-Dong/go-tool) ,记得star一下
- 本人Github地址:[https://github.com/Anthony-Dong](https://github.com/Anthony-Dong)
- 本人Leetcode项目地址:[https://github.com/Anthony-Dong/leetcode](https://github.com/Anthony-Dong/leetcode)
## 2、文件目录
{{.UrlPath}}