Skip to content

Commit ccc42a4

Browse files
committed
feat(core): initial implementation of subcommands
1 parent 4447c2c commit ccc42a4

36 files changed

+2025
-649
lines changed
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
import { CLI } from '../../src/core';
22
import { TestCommand } from './commands/test.command';
3+
import { GroupSubcommand } from './subcommand/group.subcommand';
34

45
@CLI({
56
name: 'example',
6-
declarations: [TestCommand]
7+
declarations: [
8+
TestCommand,
9+
GroupSubcommand
10+
]
711
})
812
export class ExampleCLI { }

example/src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { OrbitalFactory } from '../../src/core';
2-
import { ExampleCLI } from './cli';
2+
import { ExampleCLI } from './example.cli';
33

44
OrbitalFactory
55
.bootstrap(ExampleCLI)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { SubcommandGroup } from '../../../src/core';
2+
import { MainCommand } from './main.command';
3+
4+
@SubcommandGroup({
5+
name: 'sub',
6+
declarations: [
7+
MainCommand
8+
]
9+
})
10+
export class GroupSubcommand { }
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { Command, Executable } from '../../../src/core';
2+
3+
@Command({
4+
name: 'main'
5+
})
6+
export class MainCommand extends Executable {
7+
execute() {
8+
console.log('mainCommand');
9+
}
10+
}

example/tsconfig.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"extends": "../tsconfig.json",
3+
"include": [
4+
"./**/*.ts"
5+
],
6+
"compilerOptions": {
7+
"baseUrl": "../",
8+
"experimentalDecorators": true,
9+
"emitDecoratorMetadata": true,
10+
"sourceRoot": "src",
11+
"paths": {
12+
"@orbital/*": [
13+
"./src/*"
14+
]
15+
}
16+
}
17+
}

0 commit comments

Comments
 (0)