name: CI
on: push: branches: [main]
| import time | |
| from datetime import datetime | |
| # 格式化成2016-03-20 11:45:39形式 | |
| # print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) ) | |
| # 格式化成Sat Mar 28 22:24:24 2016形式 | |
| # print(time.strftime("%a %b %d %H:%M:%S %Y", time.localtime()) ) | |
| import os | |
| import FileUtil,TimeUtil | |
| # hulu导出数据/2022-04-01.md -> journals/2022_04_01.md,没办法,为了兼容Logseq的日志格式 | |
| def renameFileByDate(path): | |
| name =FileUtil.getFileName(path) | |
| srcDir = FileUtil.getFileDir(path) | |
| ext =FileUtil.getFileExt(path) | |
| if "-" in name: | |
| destName = TimeUtil.converDataFormat(name) |
| # traverseDirWithProcess(path,myProcess) | |
| # files = glob.glob('*.md') | |
| # if files: | |
| # files.remove('_index.md') | |
| # for f in files: | |
| # date = getDate(f).isoformat() | |
| # print(date) |
| def getDate(md_file): | |
| with open(md_file) as f: | |
| md = frontmatter.load(f) | |
| dt = md.metadata['date'] | |
| if type(dt) == str: | |
| # toml 格式下date被识别为字符串 | |
| return dateutil.parser.parse(dt).date() | |
| else: | |
| # yaml 格式下date被识别为datetime,直接返回 | |
| return dt.date() |
| import glob | |
| import shutil | |
| import dateutil.parser |
| # print(processFommatter(r"D:\Dropbox\MyObsidian\yuque\test\exports\目录05\测试标题52.md")) | |
| # print(processFommatter(r"D:\Dropbox\MyObsidian\yuque\test\exports\目录05\测试标题53.md")) | |
| # print(processFommatter(r"D:\Dropbox\MyObsidian\yuque\test\exports\title-01.md")) | |
| # print(processFommatter(r"D:\Dropbox\MyObsidian\yuque\test\exports\test-private.md")) |
| def test(): | |
| print("-------------------[test]-------------------") | |
| # print(sys.path) | |
| # cmd=f'python --version' | |
| # cmd=f'where cmd' | |
| # cmd=f'where ipconfig' | |
| cmd=f'where python' | |
| # cmdCode = os.system(cmd) | |
| # cmdResult = os.popen(cmd).read() | |
| print("cmd:", cmd) |
| "scripts": { | |
| "precommit": "lint-staged", | |
| "postpack": "rm -f oclif.manifest.json", | |
| "posttest": "tsc -p test --noEmit && tslint -p test -t stylish", | |
| "prepack": "rm -rf lib && tsc && oclif-dev manifest", | |
| "test": "nyc mocha --forbid-only \"test/**/*.test.ts\"", | |
| "commitmsg": "commitlint -e $GIT_PARAMS", | |
| "release": "standard-version" | |
| }, |