Skip to content

Commit

Permalink
Add CLI
Browse files Browse the repository at this point in the history
Closes #12
  • Loading branch information
watson committed Jan 3, 2018
1 parent 0d1492e commit 5b44773
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ CI server isn't properly detected :)
npm install is-ci --save
```

## Usage
## Programmatic Usage

```js
const isCI = require('is-ci')
Expand All @@ -25,6 +25,21 @@ if (isCI) {
}
```

## CLI Usage

For CLI usage you need to have the `is-ci` executable in your `PATH`.
There's a few ways to do that:

- Either install the module globally using `npm install is-ci -g`
- Or add the module as a dependency to your app in which case it can be
used inside your package.json scripts as is
- Or provide the full path to the executable, e.g.
`./node_modules/.bin/is-ci`

```
is-ci && echo "This is a CI server"
```

## Supported CI tools

Officially supported CI servers:
Expand Down
4 changes: 4 additions & 0 deletions bin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env node
'use strict'

process.exit(require('./') ? 0 : 1)
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "is-ci",
"version": "1.0.10",
"description": "Detect if your code is running on a CI server",
"bin": "bin.js",
"main": "index.js",
"dependencies": {
"ci-info": "^1.0.0"
Expand Down

0 comments on commit 5b44773

Please sign in to comment.