#!/usr/bin/env node
"use strict";

process.title = "oui";

var arg  = process.argv[2],
    oui  = require("./"),
    spin = require("char-spinner");

if (arg === "--update") {
    var interval = spin();
    oui.update(true, function (err) {
        clearInterval(interval);
        if (err) process.stdout.write(err + "\n");
        process.exit(err ? 1 : 0);
    });
} else if (!arg || arg === "--help") {
    process.stdout.write([
        "",
        "  Usage: oui mac [options]",
        "",
        "  Options:",
        "",
        "    --help      display this help",
        "    --update    update the database",
        "",
        ""
    ].join("\n"));
    process.exit(1);
} else {
    var result;
    try {
        result = oui(arg);
    } catch (err) {
        process.stdout.write(err.message + "\n");
        process.exit(1);
    }

    if (result) {
        process.stdout.write(result + "\n");
    } else {
        process.stdout.write(arg + " not found in database\n");
    }
    process.exit(0);
}

@@ -674,17 +674,17 @@
 ss.exit(
-1
+0
 );%0A%7D els
@@ -857,18 +857,16 @@
 (result)
- %7B
 %0A       
@@ -910,17 +910,13 @@
 %0A   
- %7D
  else
- %7B
 %0A   
@@ -976,21 +976,16 @@
 se%5Cn%22);%0A
-    %7D
 %0A    pro

Correct exit code on help