Skip to content

Commit

Permalink
expand extended version information
Browse files Browse the repository at this point in the history
  • Loading branch information
kwo committed Sep 11, 2023
1 parent ea54e1f commit 7fa3047
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 67 deletions.
4 changes: 3 additions & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ before:
hooks:
- go mod tidy
- go generate ./...
- golangci-lint run
- govulncheck -test .

builds:
- main: ./cmd/dayone2md
Expand All @@ -12,7 +14,7 @@ builds:
- osusergo
- netgo
ldflags:
- -s -w
- -s -w -X main.version={{.Summary}} -X main.commithash={{.ShortCommit}} -X main.commitdate={{.CommitDate}}
goos:
- darwin
- linux
Expand Down
11 changes: 0 additions & 11 deletions Makefile

This file was deleted.

45 changes: 32 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# DayOne To Markdown
# Dayone To Markdown

Export Dayone to Markdown.

Expand Down Expand Up @@ -64,32 +64,51 @@ Help Options:

```sh
dayone2md -i "$HOME/Library/Group Containers/5U8NS4GX82.dayoneapp2/Data/Documents/DayOne.sqlite" -o $HOME/Documents/Journal -j Journal -g -vv

OR

dayone2md -i "$HOME/Desktop/09-07-2023_8-30-PM.zip" -o $HOME/Documents/Journal -j Journal -g -vv
```

## Input Sources

TODO
### JSON Export archive

Follow these [instructions](https://dayoneapp.com/guides/tips-and-tutorials/exporting-entries/#mac) to export entries from the Dayone app to a JSON archive.

Then, use the archive location as the import source, for example:

`dayone2md -i "$HOME/Desktop/09-07-2023_8-30-PM.zip" ...`

### Database

The Dayone database on a Mac is located at

Explain that Dayone must be started to sync (Premium users) first.
`$HOME/Library/Group Containers/5U8NS4GX82.dayoneapp2/Data/Documents/DayOne.sqlite`

Location of database on Mac
To export entries directly from the database, use this location as the import source, like this:

`dayone2md -i "$HOME/Library/Group Containers/5U8NS4GX82.dayoneapp2/Data/Documents/DayOne.sqlite" ...`

The database is opened in readonly mode and an export can be performed while the Dayone app is open. Also, note that for premium users that are synchronizing data from multiple devices, the Dayone app must be run once before exporting to retrieve entries from the Dayone cloud service.

## development
Disclaimer: be careful by keeping a backup of your data. As stated in the license, this software assumes no liability for data loss.


## 🧑‍💻 development

once:
```sh
brew install goreleaser golangci-lint
go install -v golang.org/x/vuln/cmd/govulncheck@latest
```

ongoing:
```shell
make lint-fix
make lint
make install
goreleaser release --clean --snapshot
./dist/dayone2md_darwin_arm64/dayone2md --version -vv
```

## similar projects
* [joshuacoles/Dayone-Export](https://github.com/joshuacoles/Dayone-Export)
* [quantumgardener/dayone-to-obsidian](https://github.com/quantumgardener/dayone-to-obsidian)

## TODO
- [ ] abstract destination behind an interface, add memory impl for testing
- [ ] fill out database entity fields

14 changes: 13 additions & 1 deletion cmd/dayone2md/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"log/slog"
"os"
"os/signal"
"runtime"
"syscall"
"time"

Expand All @@ -14,6 +15,13 @@ import (
"kwo.dev/dayone2md"
)

//nolint:gochecknoglobals
var (
commithash = "unknown"
commitdate = "unknown"
version = "unknown"
)

func main() {
verbosity := &slog.LevelVar{}
logger := slog.New(tint.NewHandler(os.Stdout, &tint.Options{
Expand Down Expand Up @@ -47,7 +55,11 @@ func main() {

// print version and exit
if opts.PrintVersion {
fmt.Println(version(verbosity.Level() < slog.LevelWarn))
if verbosity.Level() < slog.LevelWarn {
fmt.Printf("%s %s %s %s %s/%s\n", version, commithash, commitdate, runtime.Version(), runtime.GOOS, runtime.GOARCH)
} else {
fmt.Printf("%s\n", version)
}
return
}

Expand Down
41 changes: 0 additions & 41 deletions cmd/dayone2md/version.go

This file was deleted.

0 comments on commit 7fa3047

Please sign in to comment.