Skip to content

Commit b6e287c

Browse files
authored
Merge pull request #40 from jrswab/add-yesterday-flag
Added Flag To Open Yesterday’s Journal Page
2 parents db1fcce + f4aeea5 commit b6e287c

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

CHANGELOG.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
## [Unreleased]
9+
10+
## [0.11.0] - 2025-01-03
911
### Added
1012
- `-v` flag to display the current version of lsq.
13+
- `-y` flag to open yesterday's journal file.
1114

1215
## [0.10.2] - 2025-01-03
1316
### Added
@@ -32,7 +35,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3235

3336
### Changed
3437
- README to reflect TUI deprecation
35-
- How the `d` flag operates. The full path must be specified when using this flag. Example: "/home/jaron/documents/notes"
38+
- How the `d` flag operates. The full path must be specified when using this flag. Example: "/home/jrswab/documents/notes"
3639
- No longer using the Logseq `config.edn` file.
3740
- `CONTRIBUTIONS.md` to be `CONTRIBUTING.md`
3841
- `README.md`

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ If no editor is defined in $EDITOR, then `Vim` will be used.
3232
- `-p`: Open a specific page from the pages directory.
3333
- `-s`: Specify the journal date to open. (Must be `yyyy-MM-dd` formatted)
3434
- `-v`: Display the version of lsq being executed. (Added in v0.11.0)
35+
- `-y`: Open yesterday's journal file. (Added in v0.11.0)
3536

3637
### Configuration File
3738
This file must be stored in your config directory as `lsq/config.edn`.

main.go

+6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"os"
88
"path/filepath"
99
"strings"
10+
"time"
1011

1112
"github.com/jrswab/lsq/config"
1213
"github.com/jrswab/lsq/system"
@@ -27,6 +28,7 @@ func main() {
2728
specDate := flag.String("s", "", "Open a specific journal. Use yyyy-MM-dd after the flag.")
2829
useTUI := flag.Bool("t", false, "Use the custom TUI instead of directly opening the system editor")
2930
version := flag.Bool("v", false, "Display current lsq version")
31+
yesterday := flag.Bool("y", false, "Open yesterday's journal page")
3032

3133
flag.Parse()
3234

@@ -99,6 +101,10 @@ func main() {
99101
os.Exit(1)
100102
}
101103

104+
if *yesterday {
105+
*specDate = time.Now().Add(-24 * time.Hour).Format("2006-01-02")
106+
}
107+
102108
journalPath, err := system.GetJournal(cfg, cfg.JournalsDir, *specDate)
103109
if err != nil {
104110
log.Printf("Error setting journal path: %v\n", err)

0 commit comments

Comments
 (0)