Skip to content

Commit

Permalink
Merge pull request #13 from stoneream/feature/v2
Browse files Browse the repository at this point in the history
feature/v2
  • Loading branch information
stoneream authored Aug 17, 2024
2 parents fd645f2 + 35e3f9d commit 58f6ee5
Show file tree
Hide file tree
Showing 15 changed files with 468 additions and 87 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,22 @@ jobs:
run: go get .
- name: Build for Windows
run: GOOS=windows GOARCH=amd64 go build -o diary-generator_windows_amd64/diary-generator.exe diary-generator .
- name: Copy Batch File
run: |
cp bin/archive.bat diary-generator_windows_amd64/archive.bat
cp bin/init.bat diary-generator_windows_amd64/init.bat
- name: Build for MacOS (Intel)
run: GOOS=darwin GOARCH=amd64 go build -o diary-generator_darwin_amd64/diary-generator diary-generator .
- name: Copy Shell Script (Intel)
run: |
cp bin/archive.sh diary-generator_darwin_amd64/archive.sh
cp bin/init.sh diary-generator_darwin_amd64/init.sh
- name: Build for MacOS (Apple Silicon)
run: GOOS=darwin GOARCH=arm64 go build -o diary-generator_darwin_arm64/diary-generator diary-generator .
- name: Copy Shell Script (Apple Silicon)
run: |
cp bin/archive.sh diary-generator_darwin_arm64/archive.sh
cp bin/init.sh diary-generator_darwin_arm64/init.sh
- name: Create Release Draft
id: create_release_draft
uses: release-drafter/release-drafter@v5
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ target/
.metals
.vscode
metals.sbt
diary
diary-generator*
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,30 @@
```bash
# init

diary-generator init --base-directory ./diary --template-path bin/template/diary.md
diary-generator --config ./diary/cofig init

# archive

diary-generator archive --base-directory ./diary --starts-with 2023-01
diary-generator --config ./diary/cofig init archive --target-ym 2023-01
```

## config

`config.yaml` を作成し、以下のように設定する。

```yaml
name: diary
baseDirectory: base-directory-full-path-here
templateFile: template-file-full-path-here
enabledArchiveSummary: true
```
## Windowsのタスクスケジューラーに追加する例
`F:\Dropbox\memo` 以下に当リポジトリの `bin` ディレクトリをコピーし、その中に `diary-generator.exe` がある前提の例
`F:\Dropbox\memo` 以下に当リポジトリの `bin` ディレクトリをコピー & 設定ファイルが配置済みである前提

```powershell
schtasks /create /tn "Init Diary" /tr "F:\Dropbox\memo\bin\init.bat diary" /sc daily /st 07:00
schtasks /create /tn "Init Diary" /tr "F:\Dropbox\memo\bin\init.bat ./config.yaml" /sc daily /st 07:00
```

## download
Expand Down
6 changes: 3 additions & 3 deletions bin/archive.bat
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@echo off
setlocal

set TARGET=%1
set STARTSWITH=%2
set CONFIG_FILE=%1
set TARGET_YM=%2

cd /d %~dp0

Expand All @@ -11,4 +11,4 @@ if not exist diary-generator.exe (
exit /b 1
)

diary-generator.exe archive --base-directory-path ..\%TARGET% --starts-with %STARTSWITH%
diary-generator.exe --config %CONFIG_FILE% archive --target-ym %TARGET_YM%
6 changes: 3 additions & 3 deletions bin/archive.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

TARGET=$1
STARTSWITH=$2
CONFIG_FILE=$1
TARGET_YM=$2

cd $(dirname $0)

Expand All @@ -10,4 +10,4 @@ if [ ! -e ./diary-generator ]; then
exit 1
fi

diary-generator archive --base-directory ../$TARGET --starts-with $STARTSWITH
diary-generator --config $CONFIG_FILE archive --target-ym $TARGET_YM
4 changes: 2 additions & 2 deletions bin/init.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@echo off
setlocal

set TARGET=%1
set CONFIG_FILE=%1

cd /d %~dp0

Expand All @@ -10,4 +10,4 @@ if not exist diary-generator.exe (
exit /b 1
)

diary-generator.exe init --base-directory ..\%TARGET% --template-path .\template\%TARGET%.md
diary-generator.exe --config %CONFIG_FILE% init
4 changes: 2 additions & 2 deletions bin/init.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

TARGET=$1
CONFIG_FILE=$1

cd $(dirname $0)

Expand All @@ -9,4 +9,4 @@ if [ ! -e ./diary-generator ]; then
exit 1
fi

./diary-generator init --base-directory ../$TARGET --template-file ./template/$TARGET.md
./diary-generator --config $CONFIG_FILE init
4 changes: 0 additions & 4 deletions bin/template/diary.md

This file was deleted.

Loading

0 comments on commit 58f6ee5

Please sign in to comment.