Code Monkey home page Code Monkey logo

hipchat-hotline's People

Contributors

jedcn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

hipchat-hotline's Issues

Add usage instructions (and --help?)

If you just run hipchat-hotline, you see something like this:

❯ hipchat-hotline
/opt/boxen/nodenv/versions/v0.10.31/lib/node_modules/hipchat-hotline/lib/hip-heuristic.js:63
      if (this.recipient().indexOf('@') > -1) {
                           ^
TypeError: Cannot call method 'indexOf' of undefined
    at Object.publicAPI.recipientType (/opt/boxen/nodenv/versions/v0.10.31/lib/node_modules/hipchat-hotline/lib/hip-heuristic.js:63:28)
    at sendMessage (/opt/boxen/nodenv/versions/v0.10.31/lib/node_modules/hipchat-hotline/lib/hipchat-hotline.js:28:16)
    at Object.hotline (/opt/boxen/nodenv/versions/v0.10.31/lib/node_modules/hipchat-hotline/lib/hipchat-hotline.js:37:3)

And instead you should see something like:

❯ hipchat-hotline

Usage: hipchat-hotline <recipient> <message>

Options
  When sending to either user or room:
    --message-format text | html
    --notify true | false
  When sending to room:
    --color green | red | gray | purple

Allow credentials to be stored in a file

Overview

Presently, your hip chat credentials need to be put into the environment as a variable named HIPCHAT_API_TOKEN. It would be easier if these could be stored in a file.


Approach 1: .env

When running hipchat-hotline, we could read a file named .env in the working directory and inject variables from that file into the environment and then run hipchat-hotline. This is dotenv.

Approach 2: recursively-searched-for-.envs or .hipchat-hotlinercs

A drawback of Approach 1 is that you'd always have to run hipchat-hotline from the same directory. Instead, it could work like rake and start looking "up" directories from the working directory to a file that is named .env or .hipchat-hotlinerc.

Approach 3: $HOME/.hipchat-hotlinerc

A drawback of Approach 2 is that you'd always have to run hipchat-hotline from a subdirectory of where this file was stored. That could work if you put the file at the root of your OS: /.env, but it'd fail sooner or later otherwise (say you put it in $HOME but then you ran hipchat-hotline from /tmp)

Instead, it could work by presuming a .env or a .hipchat-clientrc exists in a well known location, such as $HOME/.hipchat-hotlinerc.

Approach 4:

Some combination of all of these.

Regardless of which, my assumption is that the file would contain a line like:

HIPCHAT_API_TOKEN=XYZ

Sometimes messages are formatted incorrectly (wrong color, text when should be html, etc)

I've noticed several times with 0.1.0 that a message will be sent as the wrong color.

Meaning, I can run this command:

hipchat-hotline --color red SomeRoom "A Message"

And it'll be green instead of red. But.. if I wait 30 seconds an try again, it'll be red.

Same goes for html vs text:

hipchat-hotline [email protected] "A <b>message</b>"

And this should be sent as html (the word "message" should be in bold) but it comes in as text, and you see the bare <b>s.

However.. like is mentioned above.. if you wait 30 seconds and try again, it works.


Is this a problem with hipchat-hotline? The embedded hipchat client (hipchatter) or hipchat.com itself? I don't know.

Ensure exit codes are 0/1 for success/error

If you try to use hipchat-hotline and it encounters an error, then the exit code should be non-zero.

❯ hipchat-hotline @UserDoesNotExist Hi
Problem: Error: Target user @UserDoesNotExist is not a valid user
~ ❯ echo $?
0

That 0 should be a 1 to indicate that an error occured.

This helps with script/jenkins/whatever integration.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.