0.7.1 • Published 3 years ago

@typecli/framework v0.7.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

TypeCLI

A TypeScript library for building command-line applications in a type-strong way.

CircleCI

import { Argument, Option, Run, runSync } from '@typecli/framework';

class HelloGoodbye {
  @Option() bye?: boolean;
  @Argument() to?: string;

  get greeting() {
    return this.bye ? 'Goodbye' : 'Hello';
  }

  @Run()
  run() {
    console.log('%s, %s!', this.greeting, this.to);
  }
}

runSync(HelloGoodbye, ['world']);
runSync(HelloGoodbye, ['--bye', 'world']);

Output:

Hello world!
Goodbye world!

Install

npm install @typecli/framework

Configuring Your Compiler

Decorator

TypeCLI uses decorators. So you must enable the experimentalDecorators compiler option.

Decorator Metadata

For automatic type detection, TypeCLI refers to decorator metadata emitted by the TypeScript compiler.

To enable automatic type detection, enable the emitDecoratorMetadata compiler option.

Please note that automatic type detection is optional, but most of the documents in this repository are written assuming that the option is enabled.

About automatic type detection, see the document (WIP).

Features

Designed for TypeScript Programmers

TypeCLI is designed for TypeScript programmers. As you know, TypeScript has many features for strong typing that is useful for complex and large scale developments. Once you write models of command-line interface applications with TypeCLI, your teammates can easily read and change the source code with the awesome tools and techniques, such as code completion provided by Visual Studio Code or other editors.

Documentation

See the Book.

License

MIT

0.7.1

3 years ago

0.7.0

3 years ago

0.6.2

5 years ago

0.6.1

5 years ago

0.6.0

5 years ago

0.5.1

5 years ago

0.5.0

5 years ago

0.4.1

6 years ago

0.4.0

6 years ago

0.3.0

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago