Skip to content

Commit

Permalink
Merge pull request #28 from OpenFn/rearrannge_bin
Browse files Browse the repository at this point in the history
Moved cli index to bin/
  • Loading branch information
taylordowns2000 authored Feb 9, 2021
2 parents a494d3d + e157e7c commit 696ca76
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 14 deletions.
32 changes: 23 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,31 @@ the expression in this limited access Node VM.

## Getting Started

Clone [openfn-devTools](https://github.com/OpenFn/openfn-devtools) for a quick
setup environment on your machine. Use cli.js execute (described below) to run
jobs.
It's recommended to start by getting [openfn-devTools](https://github.com/OpenFn/openfn-devtools)
setup for a quick development environment on your machine.

### Execute
After that you can use `core execute` to run your jobs.

**Install via NPM**

```sh
npm install @openfn/core
core
```

`cli.js execute -l path/to/Adaptor -s ./tmp/state.json -e ./tmp/expression.js -o ./tmp/output.json`
**Via git**

```sh
git clone [email protected]:OpenFn/core.git
cd core
./bin/core
```

### Execute

Used to convert an expression into an executable script.

Options:
**Options**:

```
-l, --language resolvable language/adaptor path [required]
Expand All @@ -26,18 +40,18 @@ Options:
-t, --test Intercepts and logs all HTTP requests to console
```

Examples:
**Examples**

Use a module in the parent folder, and pick out the `Adaptor` member.

```
cli.js execute -l ../language-http.Adaptor -e exp.js -s state.json
core execute -l ../language-http.Adaptor -e exp.js -s state.json
```

Use a npm installed module, and pick out the `Adaptor` member.

```
cli.js execute -l language-http.Adaptor -e exp.js -s state.json
core execute -l language-http.Adaptor -e exp.js -s state.json
```

## Using Programmatically
Expand Down
7 changes: 4 additions & 3 deletions lib/cli/index.js → bin/core
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/usr/bin/env node

const yargs = require('yargs/yargs');
const { hideBin } = require('yargs/helpers');

yargs(hideBin(process.argv))
.command(require('./compile-command'))
.command(require('./execute-command'))
.command(require('../lib/cli/compile-command'))
.command(require('../lib/cli/execute-command'))
.demandCommand(1, 'must provide a command')
.help('h')
.alias('h', 'help')
.epilog('OpenFn 2021').argv;
.epilog('OpenFn 2021').argv;
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@
"url": "https://github.com/openfn/core.git"
},
"main": "./lib/index.js",
"bin": "./lib/cli/index.js",
"bin": {
"core": "./bin/core"
},
"scripts": {
"test": "mocha --recursive",
"test:watch": "mocha -w --recursive"
},
"files": [
"lib/"
"lib/",
"bin/"
],
"author": "Open Function Group",
"license": "LGPL-3.0",
Expand Down

0 comments on commit 696ca76

Please sign in to comment.