4.1.0 โ€ข Published 5 years ago

takeoff-cli v4.1.0

Weekly downloads
41
License
MIT
Repository
github
Last release
5 years ago

๐Ÿš€ takeoff is the perfect tool if you want to automate workflows with a command line integration.

Features

  • ๐Ÿ’โ€ Ultra-Easyโ„ข requiring only two properties (get, exec)
  • ๐Ÿ”Œ Plug & Play
  • ๐Ÿ’Ž No configuration required
  • ๐ŸŒŸ You can install it globaly or project-based
  • ๐Ÿง™โ€ One Dependency to rule them all
  • ๐Ÿ“ฆ Shipped with a bunch of useful utils
  • ๐Ÿ” Detects valid stations up the tree
  • โฑ Save time by automating your workflow
  • ๐Ÿ•น Interactive mode
  • ๐Ÿ’š Full tested with coverage check
  • โšก๏ธ Battle-tested, its used in several >1000 employee companies

Install

npm

npm install takeoff -g

yarn

yarn global add takeoff -g

npx

npx takeoff

Project based

Sometimes you don't want to install things global, you can also install takeoff only in specific projects

npm install takeoff --save-dev

Add to scripts in package.json:

{
  "scripts": {
    "takeoff": "takeoff"
  }
}

Then use takeoff in the project with:

npm run takeoff

Usage

Simple example which shows how fast you can create a automation

  1. Create a file: .takeoff/basic-example.js
module.exports = {
  get: 'firstname',
  exec: ({ firstname }) => {
    console.log(`๐Ÿ‘‹ Hello ${firstname}`);
  }
};
  1. Run takeoff in the folder

API

Station

A station is a object which can have the following properties

PropertyTypeRequired?Description
get*โœ“This will generate the prompts in the terminal
execFunctionโœ“Function starts when all get prompts are filled. Async and Promises are possible
nameStringGive the station a better name (default is the filename of the station)
descriptionStringAdd a short description which will be shown beside the name in the CLI

Full Example

{
  name: 'Get name',
  description: 'Ask for user details',
  get: [
    'Firstname',
    'Lastname',
    () => [
      'Age',
      (f) => new Promise(resolve => {
        console.log(42, f)
        setTimeout(() => {
          resolve(() => 'Gender')
        }, 500)
      })
    ]
  ],
  exec: function() {
    console.log('Hello World!');
  }
}

CLI

Usage: takeoff [options]

Options:
  -V, --version             output the version number
  --stations-folder [path]  Pass a custom path where takeoff should search for stations
  -h, --help                output usage information

Utils

NameDescription
Cases
CamelcaseHello World โฉ helloWorldโœ…
ParamcaseHello World โฉ hello-worldโœ…
PascalcaseHello World โฉ HelloWorldโœ…
SnakecaseHello World โฉ Hello_Worldโœ…
FileSystem
CreateFileCreate a file by passing a path and contentโœ…
CreateFolderCreate a folder by passing a pathโœ…

ยป Checkout the documentation for more details

Contribute

To contribute clone the repo

$ git clone git@github.com:entwicklerstube/takeoff.git

Now you've two ways, either you run the tests:

$ npm test

or you build it and execute takeoff localy

$ npm run build
$ node takeoff.js

Debug

We're using the package debug, so its enough to just set use the env variable DEBUG with an global like:

$ DEBUG=takeoff node takeoff.js
5.0.9

5 years ago

5.0.8

5 years ago

5.0.7

5 years ago

5.0.6

5 years ago

5.0.5

5 years ago

5.0.4

5 years ago

5.0.3

5 years ago

5.0.2

5 years ago

5.0.1

5 years ago

5.0.0

5 years ago

4.1.0

5 years ago

4.0.0

6 years ago

3.0.4

6 years ago

3.0.3

6 years ago

3.0.1

6 years ago

3.0.0

6 years ago

2.2.1

6 years ago

2.2.0

6 years ago

2.1.0

7 years ago

2.0.0

7 years ago

1.1.0

7 years ago