From 2842531dfa69eaa85220b274eba892519640f185 Mon Sep 17 00:00:00 2001 From: goropikari Date: Mon, 26 Feb 2018 03:35:03 +0900 Subject: [PATCH] trivial change --- README.md | 11 ++++++----- src/linux.jl | 29 ++++++++++++++++------------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index e8f5b98..a7dce97 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # Notifier [![Build Status](https://travis-ci.org/goropikari/Notifier.jl.svg?branch=master)](https://travis-ci.org/goropikari/Notifier.jl) +[![codecov.io](http://codecov.io/github/goropikari/Notifier.jl/coverage.svg?branch=master)](http://codecov.io/github/goropikari/Notifier.jl?branch=master) This package is notification tools for Julialang. @@ -11,15 +12,15 @@ Pkg.clone("git://github.com/goropikari/Notifier.jl.git") # Linux OS ## Setup Before using Notifier.jl, you need to install following softwares in your Linux system. -- "libnotify" for a desktop notification -- "mail" for an e-mail notification -- "aplay" (Advanced Linux Sound Architecture) for a sound notification +- `libnotify` for a desktop notification +- `mail` for an e-mail notification +- `aplay` (Advanced Linux Sound Architecture) for a sound notification ```bash -sudo apt install libnotify-bin alsa-utils mailutils heirloom-mailx bsd-mailx +$ sudo apt install libnotify-bin alsa-utils mailutils heirloom-mailx bsd-mailx ``` -This package uses "mail" linux command to notify by e-mail. Thus you need some settings in advance. +This package uses `mail` linux command to notify by e-mail. Thus you need some settings in advance. If following command works correctly, you don't need further setting. ```bash $ echo test | mail -s foo yourmail@example.com diff --git a/src/linux.jl b/src/linux.jl index 63196e1..8f8894a 100644 --- a/src/linux.jl +++ b/src/linux.jl @@ -1,9 +1,9 @@ import Base.notify -export notify, register_email, email, alarm +export notify, alarm, register_email, email @doc """ --- -notify(message::AbstractString; title::AbstractString, sound, time) +Notifier.notify(message::AbstractString; title::AbstractString, sound, time) defalut parameter\n title = "Julia"\n @@ -11,9 +11,9 @@ defalut parameter\n time = 4 # display time (seconds) """ notify function notify(message::AbstractString; - title="Julia", - sound::Union{Bool, AbstractString}=false, - time::Real=4) + title="Julia", + sound::Union{Bool, AbstractString}=false, + time::Real=4) if sound == true || typeof(sound) <: AbstractString if sound == true @async run(`aplay -q $(joinpath(@__DIR__, "default.wav"))`) @@ -26,6 +26,17 @@ function notify(message::AbstractString; return end +@doc """ + alarm(;sound::AbstractString) + notify by sound + + if you choose a specific sound WAV file, you can use it instead of the defalut sound. +""" alarm +function alarm(;sound::AbstractString=joinpath(@__DIR__, "default.wav")) + @async run(`aplay -q $sound`) + return nothing +end + @doc """ register_email() @@ -56,14 +67,6 @@ function register_email() println("If you want to change the address, modify $(abspath((joinpath(emaildir, "address.txt")))) directly or run register_email() again.") end -@doc """ - alarm(;sound::AbstractString) - notify by sound - - if you choose a specific sound WAV file, you can use it instead of the defalut sound. -""" alarm -alarm(;sound::AbstractString=joinpath(@__DIR__, "default.wav")) = @async run(`aplay -q $sound`) - @doc """ email(message; subject, To)