Skip to content

Commit

Permalink
first pass of v2 - popup for text and notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
wsw70 authored and WS committed Apr 27, 2023
1 parent 164f70a commit 9814cf8
Show file tree
Hide file tree
Showing 9 changed files with 144 additions and 80 deletions.
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"gopls": {
"build.buildFlags": [
"-tags=windows,linux"
]
}
}
47 changes: 5 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,49 +22,14 @@ go install github.com/wsw70/dly@latest

## Usage

### Interactive
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.

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.
If you use a tool such as [AutoHotKey](https://www.autohotkey.com/), you could bind a key combination to run `dly`.

### Pure command line

```
PS> dly.exe this is the text of my note
```

**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

```
PS> dly.exe this is the text of my note #happy-birthday to you
```

only the text `this is the text of my note` will be added to your note.

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.

### Quoted text

Another solution to address the comment problem above is to quote your text.

```
PS> dly.exe 'this is the text of my note #happy-birthday to you'
```

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`:

```
dly.exe --quotedText 'this is the text of my note #happy-birthday to you'
```

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.
Example for a hotkey under `Win-N`:

```
#n::
{
IB := InputBox("Add to daily note")
Run "D:\Y\dev-perso\dly\dly.exe " . IB.Value
}
#n::Run "D:\Y\dev-perso\dly\dly.exe"
```

## Debugging
Expand All @@ -91,10 +56,8 @@ The configuration file located in `.config/dly/dly.yml` in your home directory i
| `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.|
| `AddTimestamp` | no | bool | Should your line be prefixed with a bolded timestamp? |
| `AppendHashtag` | no | string | add the string as hashtag (example: `from-cli`, note the absence of `#` which will be automatically added) |
| `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`) |
| `HashtagToAdd`<br>(DEPRECATED) | no | string | The hashtag to add, without `#` |

`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.
| `ShowNotificationOnSuccess`<br>(MS Windows only) | yes | bool | Show a tray notification when the note is added |
| `ShowNotificationOnNewversion`<br>(MS Windows only) | yes | bool | Show a tray notification when a new version of `dly` is available |

## What next?

Expand Down
22 changes: 12 additions & 10 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import (
)

type Configuration struct {
DailyNotesPath string `yaml:"DailyNotesPath"`
FilenameFormat string `yaml:"FilenameFormat"`
AddTimestamp bool `yaml:"AddTimestamp"`
AppendHashtag string `yaml:"AppendHashtag"`
AddHashtag bool `yaml:"AddHashtag,omitempty"` // omitempty because we want to hide the deprecated field
HashtagToAdd string `yaml:"HashtagToAdd,omitempty"` // omitempty because we want to hide the deprecated field
DailyNotesPath string `yaml:"DailyNotesPath"`
FilenameFormat string `yaml:"FilenameFormat"`
AddTimestamp bool `yaml:"AddTimestamp"`
AppendHashtag string `yaml:"AppendHashtag"`
ShowNotificationOnSuccess bool `yaml:"ShowNotificationOnSuccess"`
ShowNotificationOnNewVersion bool `yaml:"ShowNotificationOnNewVersion"`
}

// getConfigDir queries the environment to recover the users's home and builds the path to the config directory
Expand Down Expand Up @@ -87,10 +87,12 @@ func getConfiguration() (conf Configuration) {
}
// initialize content with defaults
defaultValues := Configuration{
DailyNotesPath: "YOU MUST SET THIS to your journal folder",
FilenameFormat: "2006_01_02",
AddTimestamp: true,
AppendHashtag: "from-cli",
DailyNotesPath: "YOU MUST SET THIS to your journal folder",
FilenameFormat: "2006_01_02",
AddTimestamp: true,
AppendHashtag: "from-cli",
ShowNotificationOnSuccess: true,
ShowNotificationOnNewVersion: true,
}
defaultValuesB, _ := yaml.Marshal(defaultValues)
_, err = f.Write(defaultValuesB)
Expand Down
32 changes: 10 additions & 22 deletions dly.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main

import (
"bufio"
"errors"
"fmt"
"io"
Expand All @@ -12,6 +11,7 @@ import (
"strings"
"time"

"github.com/ncruces/zenity"
"github.com/rs/zerolog"
)

Expand Down Expand Up @@ -43,11 +43,6 @@ func init() {
func main() {
var content []byte

// if debugging check immediately for new version
if os.Getenv("DLY_DEBUG") == "yes" {
CheckUpdateNow()
}

// get user's configuration
conf := getConfiguration()

Expand All @@ -62,21 +57,18 @@ func main() {
content = addToTodayNote(content, fmt.Sprintf("%s ", textToAdd), conf)
// write the note back to file
writeTodayNote(content, todayFile, conf)
CheckUpdateNow()
if conf.ShowNotificationOnSuccess {
notifyAboutNote()
}

CheckUpdateNow(conf)
}

func getTextToAdd() (textToAdd string) {
if len(os.Args) == 1 {
// interactive mode
fmt.Print("⤑ ")
scanner := bufio.NewScanner(os.Stdin)
scanner.Scan()
textToAdd = scanner.Text()
} else if len(os.Args) == 3 && os.Args[1] == "--quotedText" {
// text to add is provided quoted
textToAdd = os.Args[2]
} else {
textToAdd = strings.Join(os.Args[1:], " ")
textToAdd, err := zenity.Entry("add to daily note")
if err != nil {
log.Info().Msgf("aborted with: %v", err)
os.Exit(1)
}
return textToAdd
}
Expand All @@ -91,10 +83,6 @@ func addToTodayNote(note []byte, newText string, conf Configuration) (content []
if conf.AppendHashtag != "" {
// new parameter
newText = fmt.Sprintf("%s #%s", newText, conf.AppendHashtag)
} else if conf.AddHashtag {
// legacy, deprecated parameter
newText = fmt.Sprintf("%s #%s", newText, conf.HashtagToAdd)
log.Warn().Msgf("the configuration parameter AddHashtag is deprecated and will be removed in a future version. Use AppendHashtag instead")
}
// check if the note does not exist
if len(note) == 0 {
Expand Down
14 changes: 14 additions & 0 deletions dly_windows_no.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//go:build !windows

package main

func notifyAboutNote() {
log.Warn().Msgf("notification is not supported on this platform")
}

func notifyAboutNewVersion(name string, conf Configuration) {
log.Warn().Msgf("new version %s available at https://github.com/wsw70/dly/releases/latest", name)
if conf.ShowNotificationOnSuccess {
log.Warn().Msgf("notification popup is not supported on this platform")
}
}
33 changes: 33 additions & 0 deletions dly_windows_yes.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//go:build windows

package main

import (
"fmt"

"gopkg.in/toast.v1"
)

func notifyAboutNote() {
notification := toast.Notification{
AppID: "dly - your daily note from CLI",
Title: "Note added",
}
err := notification.Push()
if err != nil {
log.Error().Msgf("cannot push notification: %v", err)
}
}

func notifyAboutNewVersion(name string, conf Configuration) {
notification := toast.Notification{
AppID: "dly",
Title: "new version",
Message: fmt.Sprintf("new version %s available at https://github.com/wsw70/dly/releases/latest", name),
}
err := notification.Push()
if err != nil {
log.Error().Msgf("cannot push notification: %v", err)
log.Warn().Msgf("new version %s available at https://github.com/wsw70/dly/releases/latest", name)
}
}
14 changes: 12 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,25 @@ go 1.19

require (
github.com/golang-module/carbon/v2 v2.2.3
github.com/ncruces/zenity v0.10.8
github.com/rs/zerolog v1.28.0
gopkg.in/toast.v1 v1.0.0-20180812000517-0a84660828b2
gopkg.in/yaml.v3 v3.0.1
)

require golang.org/x/net v0.0.0-20211029224645-99673261e6eb // indirect
require (
github.com/akavel/rsrc v0.10.2 // indirect
github.com/dchest/jsmin v0.0.0-20220218165748-59f39799265f // indirect
github.com/josephspurrier/goversioninfo v1.4.0 // indirect
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d // indirect
github.com/randall77/makefat v0.0.0-20210315173500-7ddd0e42c844 // indirect
golang.org/x/image v0.7.0 // indirect
golang.org/x/net v0.6.0 // indirect
)

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

// }

func CheckUpdateNow() {
func CheckUpdateNow(conf Configuration) {
type releaseApiT struct {
Name string `json:"name"`
PublishedAt string `json:"published_at"`
Expand Down Expand Up @@ -64,7 +64,7 @@ func CheckUpdateNow() {

// now compare both
if buildTimeParsed.Lt(githubReleaseTime) {
log.Warn().Msgf("new version %s available at https://github.com/wsw70/dly/releases/latest", lastUpdateOnGithub.Name)
notifyAboutNewVersion(lastUpdateOnGithub.Name, conf)
} else {
log.Debug().Msgf("no new version")
}
Expand Down

0 comments on commit 9814cf8

Please sign in to comment.