
A command-line weather app built using Elixir - tacticiankerala
https://github.com/tacticiankerala/elixir-weather
======
rnhmjoj

      function weather(){curl -s "http://api.openweathermap.org/data/2.5/weather?q=$1&units=metric" | jq .main.temp | figlet -kcf big}
    
      $ weather london
                                __  _  _     ___   _____
                               /_ || || |   |__ \ | ____|
                                | || || |_     ) || |__
                                | ||__   _|   / / |___ \
                                | |   | | _  / /_  ___) |
                                |_|   |_|(_)|____||____/

~~~
gknoy
Perhaps I'm a bash noob, but when I try to paste that in my shell, it
complains about a syntax error near `{curl`. Am I doing something wrong?

~~~
cocoflunchy
There are spacing issues for me. Try

    
    
        function weather() { curl -s "http://api.openweathermap.org/data/2.5/weather?q=$1&units=metric" | jq .main.temp | figlet -kcf big ;}

------
renekooi
Another ASCII art weather (forecast) utility, but in Go:
[https://github.com/schachmat/wego](https://github.com/schachmat/wego)

~~~
djm_
Can anyone explain why a dependency of this app is a "working Go environment"?
I thought one of golang's selling points was the fact that it created a simple
binary.

As far as I can tell, the Go environment is simply being used as a cheap
installer, is that correct?

~~~
laumars
Because he's sharing the source code rather than a compiled binary. It's no
different to having make + gcc listed as a dependency for C++ code.

~~~
frou_dh
Strictly there is a little hindrance for the non-gopher user because this
won't work until they set up a Go workspace, i.e. decided where they want
GOPATH to be, set that, and added $GOPATH/bin to PATH to have the executable
be runnable.

    
    
        $ env -i $(which go) get github.com/schachmat/wego
        package github.com/schachmat/wego: cannot download, $GOPATH not set. For more details see: go help gopath

~~~
gknoy
Absolutely. I'm happy to `apt-get install` something, but the conceptual
overhead of "let me configure a $language development environment" is high
enough that I'm not going to bother just to install this awesome looking tool.

I'd love it if this had been packaged in a way similar to Python or Node
tools, where installation is as simple as 'install Python and pip; pip install
my-program', and more-experienced users (or those who want source) can clone
the git repo.

~~~
laumars
So request a binary then. You're basically moaning that an open source project
is shipping source code.

And FYI, Go is in quite a few distro repos so you might be able to just:

    
    
      apt-get install go-lang
      mkdir -p ~/go/src ~go/bin
      export GOPATH=~/go
      go get github.com/schachmat/wego
      go install github.com/schachmat/wego
    

However considering this is an open source CLI tool, I don't think it's at all
unreasonable to expect he user to do a bit more manual work to compile and run
this tool from the command line.

In fact, quite frankly, I find it rather disgusting that someone should share
their work and source code like this and have others moan simply because
they're too bloody lazy to compile it themselves. I mean seriously guys, this
is Hacker News, not PC World Magazine.

------
nodata
It's nice, but it's not beautiful. Let's stop calling everything beautiful.

~~~
teh_klev
...and "awesome".

------
lmorris84
Should be called "temperature" rather than "weather". 21 degrees
and...raining? sunny? any cloud?

Wouldn't call it beautiful - the ascii art is really distracting.

------
anc84
Temperature accurate to three decimals? That's kinda silly. It would be more
useful to display the "felt temperature".

~~~
tormeh
As well as, you know, the weather? Like temperature is an important part of
weather, but it's often not even the most important one.

------
davidw
If you like the ascii characters like that, you might also enjoy figlet:
[http://www.figlet.org/](http://www.figlet.org/)

~~~
bshimmin
You beat me to it, so I'll just add that figlet in combination with the
inestimable cowsay
([http://en.wikipedia.org/wiki/Cowsay](http://en.wikipedia.org/wiki/Cowsay))
produces excellent results.

------
azurelogic
I'm excited about this not because I want to use it, but because it is a great
example of an Elixir app. I'm in the process of learning Elixir, and it was
cool to see someone else's code and be able to make sense of most of it.
Thanks for posting this!

~~~
ajanuary
I don't know Elixir, but it does some questionable things. For instance, it
appears to read and process the entire ascii_chars.txt file for each character
in the output. It's not a big file, but it wouldn't be difficult to read it
once.

~~~
tacticiankerala
I thought of that but for a starter I didn't want to optimise too much. But
still it's a good suggestion and I will apply "boy scout rule" for sure!

------
erikb
That's not the weather, that's the temperature. But I like the effort put into
making interesting little tools!

~~~
tacticiankerala
yeah.. that's true, it's just shows temperature.

Btw, Thanks for your kind words!

------
zaargy
curl
'[http://api.openweathermap.org/data/2.5/weather?q=london&mode...](http://api.openweathermap.org/data/2.5/weather?q=london&mode=json&units=metric')
&>/dev/null | jgrep -s main.temp | figlet

Put this in a function. Done.

Gist here since copying and pasting above didn't work.
[https://gist.github.com/zaargy/384889cb44960e8559d5](https://gist.github.com/zaargy/384889cb44960e8559d5)

~~~
feld
My first thought was "pipe into figlet, done."

------
jalada
Interesting describing ASCII art as 'beautiful'. You can tell this isn't
Designer News :P

~~~
baldfat
I son't know but I love ncurses software and find the actual UI "beautiful
since it gets me the information quickly and quickly lets me get things done.

I find my wee-chat with 256 color urxvt with Source Code Pro font in Light
Solarized to be the best looking IRC client ever :)

~~~
feld
this isn't even ncurses, it's just stdout

------
jbverschoor
Does not work (osx):

    
    
      ~/tmp/elixir-weather $ ./weather  Amsterdam
    
      =INFO REPORT==== 7-May-2015::16:37:56 ===
          application: elixir
          exited: {bad_return,
                      {{elixir,start,[normal,[]]},
                       {'EXIT',
                           {{badmatch,{error,enotsup}},
                            [{elixir,start,2,[{file,"src/elixir.erl"},{line,34}]},
                             {application_master,start_it_old,4,
                                 [{file,"application_master.erl"},{line,272}]}]}}}}
          type: temporary
      Failed to start Elixir.
      error: {error,
                 {elixir,
                     {bad_return,
                         {{elixir,start,[normal,[]]},
                          {'EXIT',
                              {{badmatch,{error,enotsup}},
                               [{elixir,start,2,[{file,"src/elixir.erl"},{line,34}]},
                                {application_master,start_it_old,4,
                                    [{file,"application_master.erl"},
                                     {line,272}]}]}}}}}}

~~~
tacticiankerala
I will look into this issue. Thanks for reporting :)

------
jhwhite
Ya know, I was just thinking about doing something like this just a couple of
days ago, but instead I wrote a python script to get the weather from
forecast.io api, then brought that into my tmux status bar.

~~~
tacticiankerala
That's great! would be nice if yo could share the source as well.

~~~
jhwhite
Ask and you shall receive! I'm very much a beginner developer so any feedback
would be appreciated.

[https://gist.github.com/jhwhite/2df093eff1f9bab74144](https://gist.github.com/jhwhite/2df093eff1f9bab74144)

------
supernintendo
I'm sorry if this comes across as negative, but this is an example of using
the wrong tool for the job, IMO.

I love Erlang and Elixir because BEAM gives me easy concurrency,
metaprogramming and best of all, fault tolerance via supervisors. For a
service that I need to stay alive, this is great. For a simple command line
utility, I'd lean more toward a compiled language like Go, Haskell, Common
Lisp, etc.

~~~
tacticiankerala
I completely understand your point. This is a project I created while learning
Elixir.

------
techdragon
I'm going to be honest... This is an ugly looking pig of a command line tool.
The giant ascii art looks bad and does nothing for its usefulness or
usability.

~~~
tacticiankerala
I am sorry for that. It was a hobby project of mine when learning Elixir and I
got excited about it.

~~~
masukomi
I've got nothing against it. it's a fun little hobby app, but yeah, I've got
to agree with the commenter above this is FAR from any standard definition of
a "beautiful" app.

~~~
tacticiankerala
I admit that :)

------
baldfat
I have used weather an old command line utility for years.

[http://fungi.yuggoth.org/weather/](http://fungi.yuggoth.org/weather/)

Pretty cool to track the temperature with your own home temperature.

------
grimmdude
[http://weather.com/](http://weather.com/)

