Skip to content

Commit

Permalink
Merge pull request hubotio#49 from dmathieu/version
Browse files Browse the repository at this point in the history
hubot -v displays the hubot's version
  • Loading branch information
tmm1 committed Oct 26, 2011
2 parents 176dde3 + c7ec529 commit c0aaea4
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion bin/hubot
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ Switches = [
[ "-a", "--adapter ADAPTER", "The Adapter to use"],
[ "-c", "--create PATH", "Create a deployable hubot"],
[ "-s", "--enable-slash", "Enable replacing the robot's name with '/'"],
[ "-n", "--name NAME", "The name of the robot in chat" ]
[ "-n", "--name NAME", "The name of the robot in chat" ],
[ "-v", "--version", "Displays the version of hubot installed"]
]

Options =
Expand Down Expand Up @@ -48,13 +49,30 @@ Parser.on "help", (opt, value) ->
console.log Parser.toString()
process.exit 0

Parser.on "version", (opt, value) ->
Options.version = true

Parser.parse process.ARGV

process.on 'SIGTERM', -> process.exit(0)

if Options.create
creator = new Creator.Creator(Options.path)
creator.run()

else if Options.version
package_path = __dirname + "/../package.json"

Fs.readFile package_path, (err,data) ->
if err
console.error "Could not open package file : %s", err
process.exit 1

content = JSON.parse(data.toString('ascii'))
console.log content['version']

process.exit 0

else
switch Options.adapter
when "irc"
Expand Down

0 comments on commit c0aaea4

Please sign in to comment.