Skip to content

Commit

Permalink
chore(src): first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
lgaticaq committed Aug 26, 2016
0 parents commit 2d52d1a
Show file tree
Hide file tree
Showing 8 changed files with 211 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
28 changes: 28 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules
lib
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
.*
LICENSE
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v6
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2016 Leonardo Gatica

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# m2m-status-cli

[![npm version](https://img.shields.io/npm/v/m2m-status-cli.svg?style=flat-square)](https://www.npmjs.com/package/m2m-status-cli)
[![npm downloads](https://img.shields.io/npm/dm/m2m-status-cli.svg?style=flat-square)](https://www.npmjs.com/package/m2m-status-cli)
[![dependency Status](https://img.shields.io/david/lgaticaq/m2m-status-cli.svg?style=flat-square)](https://david-dm.org/lgaticaq/m2m-status-cli#info=dependencies)
[![devDependency Status](https://img.shields.io/david/dev/lgaticaq/m2m-status-cli.svg?style=flat-square)](https://david-dm.org/lgaticaq/m2m-status-cli#info=devDependencies)

> CLI to check status of your m2m-status sims
## Installation

```bash
npm i -g m2m-status-cli
```

## Use

```bash
m2m-status

Usage: m2m-status -u <user> -p <password> -s <sim>

CLI to check status of your m2m-status sims

Options:

-h, --help output usage information
-V, --version output the version number
-u, --user [user] Add user
-p, --password [password] Add password
-s, --sim [sim] Add sim
```

## Example

```bash
m2m-status -u your-user -p your-password -s +569XXXXXXXX
```

## License

[MIT](https://tldrlegal.com/license/mit-license)
72 changes: 72 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"name": "m2m-status-cli",
"version": "0.0.0",
"description": "CLI to check status of your m2m-status sims",
"main": "src",
"scripts": {
"prepublish": "eslint src",
"release:major": "changelog -M && git add CHANGELOG.md && git commit -m 'updated CHANGELOG.md' && npm version major && git push origin && git push origin --tags && npm publish",
"release:minor": "changelog -m && git add CHANGELOG.md && git commit -m 'updated CHANGELOG.md' && npm version minor && git push origin && git push origin --tags && npm publish",
"release:patch": "changelog -p && git add CHANGELOG.md && git commit -m 'updated CHANGELOG.md' && npm version patch && git push origin && git push origin --tags && npm publish"
},
"engines": {
"node": ">=4"
},
"bin": {
"m2m-status": "src/index.js"
},
"preferGlobal": true,
"repository": {
"type": "git",
"url": "https://github.com/lgaticaq/m2m-status-cli.git"
},
"keywords": [
"m2m",
"sim",
"cli"
],
"author": "Leonardo Gatica <[email protected]> (https://about.me/lgatica)",
"license": "MIT",
"bugs": {
"url": "https://github.com/lgaticaq/m2m-status-cli/issues"
},
"homepage": "https://github.com/lgaticaq/m2m-status-cli#readme",
"dependencies": {
"chalk": "^1.1.3",
"commander": "^2.9.0",
"m2m-status": "0.0.2",
"update-notifier": "^1.0.2"
},
"devDependencies": {
"eslint": "^3.4.0",
"generate-changelog": "^1.0.2"
},
"eslintConfig": {
"env": {
"es6": true,
"node": true
},
"extends": "eslint:recommended",
"rules": {
"indent": [
2,
2
],
"linebreak-style": [
2,
"unix"
],
"quotes": [
2,
"single"
],
"semi": [
2,
"always"
],
"no-console": [
0
]
}
}
}
31 changes: 31 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env node

'use strict';

const program = require('commander');
const m2m = require('m2m-status');
const pkg = require('../package.json');
const updateNotifier = require('update-notifier');
const chalk = require('chalk');

updateNotifier({pkg}).notify();

program
.version(pkg.version)
.usage('-u <user> -p <password> -s <sim>')
.description('CLI to check status of your m2m-status sims')
.option('-u, --user [user]', 'Add user')
.option('-p, --password [password]', 'Add password')
.option('-s, --sim [sim]', 'Add sim')
.parse(process.argv);

if (program.user && program.password && program.sim) {
const client = new m2m({user: program.user, password: program.password});
client.checkSim(program.sim).then(result => {
console.log(chalk.green(`Administration: ${result.admin ? 'OK' : 'Error'}`));
console.log(chalk.green(`GSM: ${result.gsm ? 'OK' : 'Error'}`));
console.log(chalk.green(`GPRS: ${result.gprs ? 'OK' : 'Error'}`));
}).catch(err => console.log(chalk.red(err.message)));
} else {
program.help();
}

0 comments on commit 2d52d1a

Please sign in to comment.