## Oh Clif!!

`oh-clif` is an object oriented cli framework intended for use with typescrypt (although it can also be used with pure javascript).

### Getting started

#### Install

```bash
# npm
npm i --save oh-clif

# yarn
yarn add oh-clif
```

#### Usage

First let's build a command

`MyCommand.ts`

```typescript
interface MyParams {
  message: string;
}

export default class MyCommand extends Command<MyParams> {
  // The key used to run your command
  get key(): string {
    return 'my-command';
  }

  get options(): Option[] {
    // Register all the options I can
    // pass to my command
    return [
      {
        name: 'message',
        attributes: {
          alias: 'm'
        }
      }
    ];
  }

  // What actually happens when i run
  // my command?
  async run(params: MyParams): Promise<void> {
    console.log(params?.message || 'No message');
  }
}
```

Now let's build a CLI

`MyCLI.ts`

```typescript
class MyCLI extends CLI {
  get commands(): Command<any>[] {
    // Register my command
    return [new MyCommand()];
  }
}
```

Now we just need to call the `init()` function in our entrypoint

`myScript.ts`

```typescript
#! /usr/bin/env node
new MyCLI().init();
```
