aboutsummaryrefslogtreecommitdiff
path: root/src/utils/weather.rs
diff options
context:
space:
mode:
authorMustafa Salih <37256744+MustafaSalih1993@users.noreply.github.com>2021-02-03 03:43:31 +0300
committerGitHub <noreply@github.com>2021-02-03 03:43:31 +0300
commitc4cd23f471fe8d6fdac7ddca436b477c16031373 (patch)
treebb25b89e1f1186d2f06a7b1ad12bbf26c6d23cac /src/utils/weather.rs
parent303808ea191f4c8d047c14a77a1bd322d4dcc081 (diff)
parent0359a01cc89b1bbcf0bd08799d2c8dfd09f609d0 (diff)
Merge pull request #44 from MustafaSalih1993/dev
removed some doublicated code
Diffstat (limited to 'src/utils/weather.rs')
-rw-r--r--src/utils/weather.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/utils/weather.rs b/src/utils/weather.rs
index 9dc053b..11e446f 100644
--- a/src/utils/weather.rs
+++ b/src/utils/weather.rs
@@ -1,7 +1,8 @@
use crate::config::CONFIG;
+use crate::types::ThreadsData;
// will make a GET request from wttr.in
-pub fn get_weather() -> String {
+pub fn get_weather() -> ThreadsData {
let format = if CONFIG.weather.format.is_empty() {
String::from("%l:+%t")
} else {
@@ -18,5 +19,6 @@ pub fn get_weather() -> String {
Err(_) => err_string,
};
- format!(" {} {} {}", CONFIG.weather.icon, res, CONFIG.seperator)
+ let data = format!(" {} {} {}", CONFIG.weather.icon, res, CONFIG.seperator);
+ ThreadsData::Weather(data)
}