/orbital

Build CLIs quickly and easily with TypeScript. Now in alpha.

Primary LanguageTypeScriptMIT LicenseMIT

Build Status Maintainability Test Coverage Join the chat at https://gitter.im/orbital-js/orbital

Orbital

Orbital is a dead-simple, cutting-edge CLI framework. Taking cues from Angular and Clime, Orbital was designed with simplicity and scalability in mind.

Motivations

The Orbital Core team members were originally contributors to the Nest CLI for the increasingly popular Nest framework. We found it difficult to contribute since the codebase was complex, and so CLI development stagnated. We decided to rewrite the CLI with a new framework we'd create ourselves, that would be fast, scalable, and easy to understand. Thus, Orbital was born.

What we're moving towards

/// example.cli.ts
import { CLI, Executable } from '@orbital/core';

import { ExampleCommand } from './commands/example/example.command';
import { InfoCommand } from './commands/info.command';

@CLI({
   name: 'example',
   version: '1.0.0',
   commands: [
      ExampleCommand,
      InfoCommand
   ]
})
export class ExampleCLI implements Executable {
   execute() { }
}
/// commands/example/example.command.ts
import { Parameter, Command, Executable, Option, UseOptions, VariadicParameter } from '@orbital/core';

import { ServiceCommand } from './service/service.command';

@Command({
    name: 'example',
    aliases: ['e'],
    brief: 'This is a one line description',
    description: `
      This is a long decription,
      It is split across multiple lines
    `,
    subCommands: [
        ServiceCommand
    ]
})
export class ExampleCommand implements Executable {

    @Option({
        flag: 'b',
        brief: '',
        description: '',
        validators: []
    })
    bar: string;

    constructor(
        @UseOptions(GenerateOptions) private options: GenerateOptions
    ) { }

    execute(
        @Parameter({
            brief: '',
            description: '',
            validators: []
        }) url: URL,

        @Parameter({
            brief: '',
            description: '',
            required: false,
            validators: []
        }) optional: string,

        @VariadicParameter({
            validators: []
        }) foo: string[]
    ) {
        // implementation
    }
}