Skip to content

Commit a2d3e56

Browse files
Clearing all draft to cloud
1 parent 86ca964 commit a2d3e56

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+2095
-504
lines changed

addon/common/cli/tsconfig.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ES2020",
4+
"module": "CommonJS",
5+
"outDir": "./dist",
6+
"rootDir": "./src",
7+
"strict": true,
8+
"esModuleInterop": true,
9+
"forceConsistentCasingInFileNames": true
10+
},
11+
"include": [
12+
"src/**/*.ts"
13+
]
14+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "caporal",
3+
"version": "1.0.0",
4+
"main": "index.js",
5+
"license": "MIT",
6+
"dependencies": {
7+
"caporal": "^1.4.0"
8+
}
9+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env node
2+
3+
const { program } = require('@caporal/core');
4+
5+
program
6+
.version('1.0.0')
7+
.description('A simple CLI application to greet users')
8+
.command('greet', 'Greet a user')
9+
.argument('<name>', 'Name of the user')
10+
.action(({ logger, args }) => {
11+
logger.info(`Hello, ${args.name}!`);
12+
})
13+
.command('help', 'Show help information')
14+
.action(({ logger }) => {
15+
logger.info(`Usage: greet [options]
16+
Options:
17+
greet <name> Specify the name to greet
18+
help Show help information
19+
version Show version information`);
20+
})
21+
.command('version', 'Show version information')
22+
.action(({ logger }) => {
23+
logger.info(`greet version 1.0.0`);
24+
});
25+
26+
program.run();
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "greet-cli-caporal-ts",
3+
"version": "1.0.0",
4+
"description": "A simple CLI application to greet users",
5+
"main": "dist/index.js",
6+
"bin": {
7+
"greet": "./dist/index.js"
8+
},
9+
"scripts": {
10+
"build": "tsc",
11+
"start": "ts-node src/index.ts",
12+
"test": "mocha --require ts-node/register tests/**/*.test.ts"
13+
},
14+
"author": "Your Name",
15+
"license": "ISC",
16+
"dependencies": {
17+
"@caporal/core": "^1.0.0"
18+
},
19+
"devDependencies": {
20+
"typescript": "^4.4.4",
21+
"ts-node": "^10.4.0",
22+
"@types/node": "^16.11.6"
23+
}
24+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env node
2+
3+
import { program } from '@caporal/core';
4+
5+
const logger = console;
6+
7+
program
8+
.version('1.0.0')
9+
.description('A simple CLI application to greet users')
10+
.command('greet', 'Greet a user')
11+
.argument('<name>', 'Name of the user')
12+
.action(({ logger, args }) => {
13+
logger.info(`Hello, ${args.name}!`);
14+
})
15+
.command('help', 'Show help information')
16+
.action(({ logger }) => {
17+
logger.info(`Usage: greet [options]
18+
Options:
19+
greet <name> Specify the name to greet
20+
help Show help information
21+
version Show version information`);
22+
})
23+
.command('version', 'Show version information')
24+
.action(({ logger }) => {
25+
logger.info(`greet version 1.0.0`);
26+
});
27+
28+
program.run();
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "greet-cli-commander",
3+
"version": "1.0.0",
4+
"description": "A simple CLI application to greet users",
5+
"main": "src/index.js",
6+
"bin": {
7+
"greet": "./src/index.js"
8+
},
9+
"scripts": {
10+
"start": "node src/index.js"
11+
},
12+
"author": "Your Name",
13+
"license": "ISC",
14+
"dependencies": {
15+
"commander": "^10.0.0"
16+
}
17+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env node
2+
3+
const { Command } = require('commander');
4+
5+
const program = new Command();
6+
7+
program
8+
.version('1.0.0')
9+
.description('A simple CLI application to greet users');
10+
11+
program
12+
.command('greet <name>')
13+
.description('Greet a user')
14+
.action((name) => {
15+
console.log(`Hello, ${name}!`);
16+
});
17+
18+
program
19+
.command('help')
20+
.description('Show help information')
21+
.action(() => {
22+
console.log(`Usage: greet [options]
23+
Options:
24+
greet <name> Specify the name to greet
25+
help Show help information
26+
version Show version information`);
27+
});
28+
29+
program
30+
.command('version')
31+
.description('Show version information')
32+
.action(() => {
33+
console.log('greet version 1.0.0');
34+
});
35+
36+
program.parse(process.argv);
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "greet-cli-commander-ts",
3+
"version": "1.0.0",
4+
"description": "A simple CLI application to greet users",
5+
"main": "dist/index.js",
6+
"bin": {
7+
"greet": "./dist/index.js"
8+
},
9+
"scripts": {
10+
"build": "tsc",
11+
"start": "ts-node src/index.ts"
12+
},
13+
"author": "Your Name",
14+
"license": "ISC",
15+
"dependencies": {
16+
"commander": "^10.0.0"
17+
},
18+
"devDependencies": {
19+
"typescript": "^4.4.4",
20+
"ts-node": "^10.4.0",
21+
"@types/node": "^16.11.6"
22+
}
23+
}
24+
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env node
2+
3+
import { Command } from 'commander';
4+
5+
const program = new Command();
6+
7+
program
8+
.version('1.0.0')
9+
.description('A simple CLI application to greet users');
10+
11+
program
12+
.command('greet <name>')
13+
.description('Greet a user')
14+
.action((name: string) => {
15+
console.log(`Hello, ${name}!`);
16+
});
17+
18+
program
19+
.command('help')
20+
.description('Show help information')
21+
.action(() => {
22+
console.log(`Usage: greet [options]
23+
Options:
24+
greet <name> Specify the name to greet
25+
help Show help information
26+
version Show version information`);
27+
});
28+
29+
program
30+
.command('version')
31+
.description('Show version information')
32+
.action(() => {
33+
console.log('greet version 1.0.0');
34+
});
35+
36+
program.parse(process.argv);
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "greet-cli",
3+
"version": "1.0.0",
4+
"description": "A simple CLI application to greet users",
5+
"main": "src/index.js",
6+
"bin": {
7+
"greet": "./src/index.js"
8+
},
9+
"scripts": {
10+
"test": "echo \"Error: no test specified\" && exit 1"
11+
},
12+
"author": "Your Name",
13+
"license": "ISC"
14+
}

0 commit comments

Comments
 (0)