Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Message setting doesn't work #72

Closed
tkcranny opened this issue Jan 24, 2018 · 6 comments
Closed

Message setting doesn't work #72

tkcranny opened this issue Jan 24, 2018 · 6 comments
Labels

Comments

@tkcranny
Copy link

tkcranny commented Jan 24, 2018

Description

The --message / -m flag is not correctly setting the message field of notifications. No matter what is specified, the message field is always the string "Done!".

Steps to reproduce

noti -t "My Title" -m "My Message"

This behaviour occurs when the configuration file is missing. An empty file resolves it, as pointed out by @heidark.

Expected behavior

The message field of notification popups / voice readouts to be "My Message".

Actual behavior

The message fields remains the default string "Done!".
screen shot 2018-01-24 at 4 17 07 pm

Version

3.0.0, installed via Homebrew on MacOs 10.13.2

screen shot 2018-01-24 at 4 17 13 pm

@variadico variadico added the bug label Jan 24, 2018
@variadico
Copy link
Owner

Hm, strange. I can't seem to repro. Can you share the output of this command?

noti --verbose -t "My Title" -m "My Message"

@tkcranny
Copy link
Author

Sure Thing:

$ noti --verbose -t "My Title" -m "My Message"
Failed to configure: failed to read config file: [open .noti.yaml: no such file or directory open /Users/tkc/.config/noti/noti.yaml: no such file or directory]
title: My Title
Running command: []
Services: map[banner:{}]
Viper: map[title:My Title say:map[voice:Alex] pushbullet:map[accesstoken:] bearychat:map[incominghookuri:] message:Done! simplepush:map[key: event:] slack:map[channel: username:noti token:] hipchat:map[room: accesstoken:] defaults:[banner] espeak:map[voicename:english-us] pushover:map[apitoken: userkey:] nsuser:map[soundnamefail:Basso soundname:Ping] pushsafer:map[key:] speechsynthesizer:map[voice:Microsoft David Desktop]]
1 notifications queued
Sent: *nsuser.Notification

@heidark
Copy link

heidark commented Feb 28, 2018

If there is no .noti.yaml in the folder you are in when you run noti, it ignores the message flag.

creating a empty .noti.yaml file fixes the problem but only for that given directory.

the issue might here:

// Don't care about this error, fileFlag can be blank.
fileFlag, _ := flags.GetString("file")
if err := setupConfigFile(fileFlag, v); err != nil {
return err
}
if flags == nil {
return nil
}
return v.BindPFlag("message", flags.Lookup("message"))

@tkcranny
Copy link
Author

Creating an empty file ~/.config/noti/noti.yaml worked, thank you kindly @heidark.

@variadico
Copy link
Owner

Ooooh, nice! I can definitely reproduce this now! Thanks @heidark! Patch release will be coming soon!

variadico pushed a commit that referenced this issue Mar 2, 2018
Currently, if you don't have a noti config file, setting the
notification message with --message doesn't work. This is because noti
stops configuration after reading the config file fails.

This change just logs that error instead of returning, since it's a
non-fatal error. It also fixes the unit test that should have caught
this.

Resolves #72
@variadico
Copy link
Owner

Thanks everyone!
I believe this should be fixed on latest dev.

Closing now. Patch release will be coming soon!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants