Skip to content

Commit 9814cf8

Browse files
wsw70WS
authored andcommitted
first pass of v2 - popup for text and notifications
1 parent 164f70a commit 9814cf8

File tree

9 files changed

+144
-80
lines changed

9 files changed

+144
-80
lines changed

.vscode/settings.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"gopls": {
3+
"build.buildFlags": [
4+
"-tags=windows,linux"
5+
]
6+
}
7+
}

README.md

Lines changed: 5 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -22,49 +22,14 @@ go install github.com/wsw70/dly@latest
2222

2323
## Usage
2424

25-
### Interactive
25+
Run `dly.exe`, a pop-up window appears to allow you to type your line. Once you are done press `Enter` (or click `OK`) and your daily note is updated.
2626

27-
Run `dly.exe`, a prompt (``) appears to allow you to type your line. Once you are done press `Enter` and your daily note is updated.
27+
If you use a tool such as [AutoHotKey](https://www.autohotkey.com/), you could bind a key combination to run `dly`.
2828

29-
### Pure command line
30-
31-
```
32-
PS> dly.exe this is the text of my note
33-
```
34-
35-
**Warning** if your shell uses `#` to denote a comment (PowerShell, Bash, ...) you cannot add a tag in the pure command line mode. In other words if you type
36-
37-
```
38-
PS> dly.exe this is the text of my note #happy-birthday to you
39-
```
40-
41-
only the text `this is the text of my note` will be added to your note.
42-
43-
I would love a workaround, but it seems there are none. This is also the reason for the interactive mode that does not have this limitation.
44-
45-
### Quoted text
46-
47-
Another solution to address the comment problem above is to quote your text.
48-
49-
```
50-
PS> dly.exe 'this is the text of my note #happy-birthday to you'
51-
```
52-
53-
This is extremely cumbersome and I would forget to add the quotes half of the time. If you can somehow integrate a quoted text in your command (function, alias, ...) there is a special argument to `dyl`: `--quotedText`:
54-
55-
```
56-
dly.exe --quotedText 'this is the text of my note #happy-birthday to you'
57-
```
58-
59-
If you use a tool such as [AutoHotKey](https://www.autohotkey.com/), you could bind a key combination to pop-up a form. It would be even faster than typing in the shell if you are not there.
6029
Example for a hotkey under `Win-N`:
6130

6231
```
63-
#n::
64-
{
65-
IB := InputBox("Add to daily note")
66-
Run "D:\Y\dev-perso\dly\dly.exe " . IB.Value
67-
}
32+
#n::Run "D:\Y\dev-perso\dly\dly.exe"
6833
```
6934

7035
## Debugging
@@ -91,10 +56,8 @@ The configuration file located in `.config/dly/dly.yml` in your home directory i
9156
| `FilenameFormat` | yes | string | Format of your daily note, without the `.md` extension. The format follows (weird) Go formatting rules, see the [documentation](https://pkg.go.dev/time) or an [article](https://www.geeksforgeeks.org/time-formatting-in-golang/) for details. As a general rule, when you want to say "the current year" and expected something like `YYYY`, you use `2006` (yes, exactly this string). The "current month" is `01` and the "current day" is `02`. Yes this is insane. The default format (in the auto-generated file) is `2006_01_02` - this corresponds today to `2023_01_13` which in turns points to the file `2023_01_13.md`, which **Logseq** interprets as the date 2023-01-13.|
9257
| `AddTimestamp` | no | bool | Should your line be prefixed with a bolded timestamp? |
9358
| `AppendHashtag` | no | string | add the string as hashtag (example: `from-cli`, note the absence of `#` which will be automatically added) |
94-
| `AddHashtag`<br>(DEPRECATED) | no | bool | Should a tag be added at the end of your line? (usually to mark lines that were added though `dly`) |
95-
| `HashtagToAdd`<br>(DEPRECATED) | no | string | The hashtag to add, without `#` |
96-
97-
`AddHashtag` and `HashtagToAdd` are deprecated and will be removed in the next major version. having two parameters for a singe, simple feature does not make much sense.
59+
| `ShowNotificationOnSuccess`<br>(MS Windows only) | yes | bool | Show a tray notification when the note is added |
60+
| `ShowNotificationOnNewversion`<br>(MS Windows only) | yes | bool | Show a tray notification when a new version of `dly` is available |
9861

9962
## What next?
10063

config.go

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ import (
1414
)
1515

1616
type Configuration struct {
17-
DailyNotesPath string `yaml:"DailyNotesPath"`
18-
FilenameFormat string `yaml:"FilenameFormat"`
19-
AddTimestamp bool `yaml:"AddTimestamp"`
20-
AppendHashtag string `yaml:"AppendHashtag"`
21-
AddHashtag bool `yaml:"AddHashtag,omitempty"` // omitempty because we want to hide the deprecated field
22-
HashtagToAdd string `yaml:"HashtagToAdd,omitempty"` // omitempty because we want to hide the deprecated field
17+
DailyNotesPath string `yaml:"DailyNotesPath"`
18+
FilenameFormat string `yaml:"FilenameFormat"`
19+
AddTimestamp bool `yaml:"AddTimestamp"`
20+
AppendHashtag string `yaml:"AppendHashtag"`
21+
ShowNotificationOnSuccess bool `yaml:"ShowNotificationOnSuccess"`
22+
ShowNotificationOnNewVersion bool `yaml:"ShowNotificationOnNewVersion"`
2323
}
2424

2525
// getConfigDir queries the environment to recover the users's home and builds the path to the config directory
@@ -87,10 +87,12 @@ func getConfiguration() (conf Configuration) {
8787
}
8888
// initialize content with defaults
8989
defaultValues := Configuration{
90-
DailyNotesPath: "YOU MUST SET THIS to your journal folder",
91-
FilenameFormat: "2006_01_02",
92-
AddTimestamp: true,
93-
AppendHashtag: "from-cli",
90+
DailyNotesPath: "YOU MUST SET THIS to your journal folder",
91+
FilenameFormat: "2006_01_02",
92+
AddTimestamp: true,
93+
AppendHashtag: "from-cli",
94+
ShowNotificationOnSuccess: true,
95+
ShowNotificationOnNewVersion: true,
9496
}
9597
defaultValuesB, _ := yaml.Marshal(defaultValues)
9698
_, err = f.Write(defaultValuesB)

dly.go

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package main
22

33
import (
4-
"bufio"
54
"errors"
65
"fmt"
76
"io"
@@ -12,6 +11,7 @@ import (
1211
"strings"
1312
"time"
1413

14+
"github.com/ncruces/zenity"
1515
"github.com/rs/zerolog"
1616
)
1717

@@ -43,11 +43,6 @@ func init() {
4343
func main() {
4444
var content []byte
4545

46-
// if debugging check immediately for new version
47-
if os.Getenv("DLY_DEBUG") == "yes" {
48-
CheckUpdateNow()
49-
}
50-
5146
// get user's configuration
5247
conf := getConfiguration()
5348

@@ -62,21 +57,18 @@ func main() {
6257
content = addToTodayNote(content, fmt.Sprintf("%s ", textToAdd), conf)
6358
// write the note back to file
6459
writeTodayNote(content, todayFile, conf)
65-
CheckUpdateNow()
60+
if conf.ShowNotificationOnSuccess {
61+
notifyAboutNote()
62+
}
63+
64+
CheckUpdateNow(conf)
6665
}
6766

6867
func getTextToAdd() (textToAdd string) {
69-
if len(os.Args) == 1 {
70-
// interactive mode
71-
fmt.Print("⤑ ")
72-
scanner := bufio.NewScanner(os.Stdin)
73-
scanner.Scan()
74-
textToAdd = scanner.Text()
75-
} else if len(os.Args) == 3 && os.Args[1] == "--quotedText" {
76-
// text to add is provided quoted
77-
textToAdd = os.Args[2]
78-
} else {
79-
textToAdd = strings.Join(os.Args[1:], " ")
68+
textToAdd, err := zenity.Entry("add to daily note")
69+
if err != nil {
70+
log.Info().Msgf("aborted with: %v", err)
71+
os.Exit(1)
8072
}
8173
return textToAdd
8274
}
@@ -91,10 +83,6 @@ func addToTodayNote(note []byte, newText string, conf Configuration) (content []
9183
if conf.AppendHashtag != "" {
9284
// new parameter
9385
newText = fmt.Sprintf("%s #%s", newText, conf.AppendHashtag)
94-
} else if conf.AddHashtag {
95-
// legacy, deprecated parameter
96-
newText = fmt.Sprintf("%s #%s", newText, conf.HashtagToAdd)
97-
log.Warn().Msgf("the configuration parameter AddHashtag is deprecated and will be removed in a future version. Use AppendHashtag instead")
9886
}
9987
// check if the note does not exist
10088
if len(note) == 0 {

dly_windows_no.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//go:build !windows
2+
3+
package main
4+
5+
func notifyAboutNote() {
6+
log.Warn().Msgf("notification is not supported on this platform")
7+
}
8+
9+
func notifyAboutNewVersion(name string, conf Configuration) {
10+
log.Warn().Msgf("new version %s available at https://github.com/wsw70/dly/releases/latest", name)
11+
if conf.ShowNotificationOnSuccess {
12+
log.Warn().Msgf("notification popup is not supported on this platform")
13+
}
14+
}

dly_windows_yes.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
//go:build windows
2+
3+
package main
4+
5+
import (
6+
"fmt"
7+
8+
"gopkg.in/toast.v1"
9+
)
10+
11+
func notifyAboutNote() {
12+
notification := toast.Notification{
13+
AppID: "dly - your daily note from CLI",
14+
Title: "Note added",
15+
}
16+
err := notification.Push()
17+
if err != nil {
18+
log.Error().Msgf("cannot push notification: %v", err)
19+
}
20+
}
21+
22+
func notifyAboutNewVersion(name string, conf Configuration) {
23+
notification := toast.Notification{
24+
AppID: "dly",
25+
Title: "new version",
26+
Message: fmt.Sprintf("new version %s available at https://github.com/wsw70/dly/releases/latest", name),
27+
}
28+
err := notification.Push()
29+
if err != nil {
30+
log.Error().Msgf("cannot push notification: %v", err)
31+
log.Warn().Msgf("new version %s available at https://github.com/wsw70/dly/releases/latest", name)
32+
}
33+
}

go.mod

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,25 @@ go 1.19
44

55
require (
66
github.com/golang-module/carbon/v2 v2.2.3
7+
github.com/ncruces/zenity v0.10.8
78
github.com/rs/zerolog v1.28.0
9+
gopkg.in/toast.v1 v1.0.0-20180812000517-0a84660828b2
810
gopkg.in/yaml.v3 v3.0.1
911
)
1012

11-
require golang.org/x/net v0.0.0-20211029224645-99673261e6eb // indirect
13+
require (
14+
github.com/akavel/rsrc v0.10.2 // indirect
15+
github.com/dchest/jsmin v0.0.0-20220218165748-59f39799265f // indirect
16+
github.com/josephspurrier/goversioninfo v1.4.0 // indirect
17+
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d // indirect
18+
github.com/randall77/makefat v0.0.0-20210315173500-7ddd0e42c844 // indirect
19+
golang.org/x/image v0.7.0 // indirect
20+
golang.org/x/net v0.6.0 // indirect
21+
)
1222

1323
require (
1424
github.com/go-resty/resty/v2 v2.7.0
1525
github.com/mattn/go-colorable v0.1.12 // indirect
1626
github.com/mattn/go-isatty v0.0.14 // indirect
17-
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6 // indirect
27+
golang.org/x/sys v0.7.0 // indirect
1828
)

go.sum

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,88 @@
1+
github.com/akavel/rsrc v0.10.2 h1:Zxm8V5eI1hW4gGaYsJQUhxpjkENuG91ki8B4zCrvEsw=
2+
github.com/akavel/rsrc v0.10.2/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c=
13
github.com/coreos/go-systemd/v22 v22.3.3-0.20220203105225-a9a7ef127534/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
24
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
35
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
46
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
7+
github.com/dchest/jsmin v0.0.0-20220218165748-59f39799265f h1:OGqDDftRTwrvUoL6pOG7rYTmWsTCvyEWFsMjg+HcOaA=
8+
github.com/dchest/jsmin v0.0.0-20220218165748-59f39799265f/go.mod h1:Dv9D0NUlAsaQcGQZa5kc5mqR9ua72SmA8VXi4cd+cBw=
59
github.com/go-resty/resty/v2 v2.7.0 h1:me+K9p3uhSmXtrBZ4k9jcEAfJmuC8IivWHwaLZwPrFY=
610
github.com/go-resty/resty/v2 v2.7.0/go.mod h1:9PWDzw47qPphMRFfhsyk0NnSgvluHcljSMVIq3w7q0I=
711
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
812
github.com/golang-module/carbon/v2 v2.2.3 h1:WvGIc5+qzq9drNzH+Gnjh1TZ0JgDY/IA+m2Dvk7Qm4Q=
913
github.com/golang-module/carbon/v2 v2.2.3/go.mod h1:LdzRApgmDT/wt0eNT8MEJbHfJdSqCtT46uZhfF30dqI=
14+
github.com/josephspurrier/goversioninfo v1.4.0 h1:Puhl12NSHUSALHSuzYwPYQkqa2E1+7SrtAPJorKK0C8=
15+
github.com/josephspurrier/goversioninfo v1.4.0/go.mod h1:JWzv5rKQr+MmW+LvM412ToT/IkYDZjaclF2pKDss8IY=
1016
github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40=
1117
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
1218
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
1319
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
20+
github.com/ncruces/zenity v0.10.8 h1:vNwTJazgxj47VOBXqik14fN8ML5eLMhl/Nw646Ln/7o=
21+
github.com/ncruces/zenity v0.10.8/go.mod h1:gPHbGF/lkwfJS3wdVG9sXYgK8c0vLAXkA2xHacOiFZY=
22+
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d h1:VhgPp6v9qf9Agr/56bj7Y/xa04UccTW04VP0Qed4vnQ=
23+
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U=
1424
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
1525
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
1626
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
27+
github.com/randall77/makefat v0.0.0-20210315173500-7ddd0e42c844 h1:GranzK4hv1/pqTIhMTXt2X8MmMOuH3hMeUR0o9SP5yc=
28+
github.com/randall77/makefat v0.0.0-20210315173500-7ddd0e42c844/go.mod h1:T1TLSfyWVBRXVGzWd0o9BI4kfoO9InEgfQe4NV3mLz8=
1729
github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
1830
github.com/rs/zerolog v1.28.0 h1:MirSo27VyNi7RJYP3078AA1+Cyzd2GB66qy3aUHvsWY=
1931
github.com/rs/zerolog v1.28.0/go.mod h1:NILgTygv/Uej1ra5XxGf82ZFSLk58MFGAUS2o6usyD0=
2032
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
2133
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
2234
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
35+
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
2336
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
2437
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
2538
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
2639
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
27-
golang.org/x/net v0.0.0-20211029224645-99673261e6eb h1:pirldcYWx7rx7kE5r+9WsOXPXK0+WH5+uZ7uPmJ44uM=
40+
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
41+
go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A=
42+
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
43+
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
44+
golang.org/x/image v0.7.0 h1:gzS29xtG1J5ybQlv0PuyfE3nmc6R4qB73m6LUUmvFuw=
45+
golang.org/x/image v0.7.0/go.mod h1:nd/q4ef1AKKYl/4kft7g+6UyGbdiqWqTP1ZAbRoV7Rg=
46+
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
47+
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
48+
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
49+
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
2850
golang.org/x/net v0.0.0-20211029224645-99673261e6eb/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
51+
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
52+
golang.org/x/net v0.6.0 h1:L4ZwwTvKW9gr0ZMS1yrHD9GZhIuVjOBBnaKH+SPQK0Q=
53+
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
54+
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
55+
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
56+
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
57+
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
2958
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
3059
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
60+
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
3161
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
32-
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6 h1:foEbQz/B0Oz6YIqu/69kfXPYeFQAuuMYFkjaqXzl5Wo=
3362
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
63+
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
64+
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
65+
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
66+
golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU=
67+
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
3468
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
69+
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
70+
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
71+
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
72+
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
3573
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
74+
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
75+
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
76+
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
3677
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
78+
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
79+
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
80+
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
81+
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
3782
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
3883
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
84+
gopkg.in/toast.v1 v1.0.0-20180812000517-0a84660828b2 h1:MZF6J7CV6s/h0HBkfqebrYfKCVEo5iN+wzE4QhV3Evo=
85+
gopkg.in/toast.v1 v1.0.0-20180812000517-0a84660828b2/go.mod h1:s1Sn2yZos05Qfs7NKt867Xe18emOmtsO3eAKbDaon0o=
3986
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
4087
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
4188
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

update.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ var buildTime string
3434

3535
// }
3636

37-
func CheckUpdateNow() {
37+
func CheckUpdateNow(conf Configuration) {
3838
type releaseApiT struct {
3939
Name string `json:"name"`
4040
PublishedAt string `json:"published_at"`
@@ -64,7 +64,7 @@ func CheckUpdateNow() {
6464

6565
// now compare both
6666
if buildTimeParsed.Lt(githubReleaseTime) {
67-
log.Warn().Msgf("new version %s available at https://github.com/wsw70/dly/releases/latest", lastUpdateOnGithub.Name)
67+
notifyAboutNewVersion(lastUpdateOnGithub.Name, conf)
6868
} else {
6969
log.Debug().Msgf("no new version")
7070
}

0 commit comments

Comments
 (0)