klei-cli 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +71 -0
- package/bin/cli.js +85 -0
- package/bin/cli.mjs +62 -0
- package/package.json +68 -0
package/README.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# KLEI CLI
|
|
2
|
+
|
|
3
|
+
KLEI CLI es una herramienta de línea de comandos profesional con múltiples características.
|
|
4
|
+
|
|
5
|
+
## Instalación
|
|
6
|
+
|
|
7
|
+
Para instalar las dependencias del proyecto, ejecuta:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @kreisler/klei
|
|
11
|
+
# o
|
|
12
|
+
pnpm install -g @kreisler/klei
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Uso
|
|
16
|
+
|
|
17
|
+
Para usar la CLI, puedes ejecutar los siguientes comandos:
|
|
18
|
+
|
|
19
|
+
### Mostrar Ayuda
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
klei ayuda
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Este comando muestra la ayuda y los comandos disponibles.
|
|
26
|
+
|
|
27
|
+
### Saludar
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
klei saludar <nombre> [opciones]
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Este comando saluda al usuario especificado.
|
|
34
|
+
|
|
35
|
+
#### Opciones
|
|
36
|
+
|
|
37
|
+
- `-e, --exclamar`: Agrega una exclamación al saludo.
|
|
38
|
+
|
|
39
|
+
## Comandos Disponibles
|
|
40
|
+
|
|
41
|
+
- `saludar <nombre>`: Saluda al usuario.
|
|
42
|
+
- `-e, --exclamar`: Agrega una exclamación al saludo.
|
|
43
|
+
- `help`: Muestra la ayuda y los comandos disponibles.
|
|
44
|
+
|
|
45
|
+
## Ejemplos
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
klei saludar Juan -e
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Este comando saluda a Juan con una exclamación.
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
klei ayuda
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Este comando muestra la ayuda.
|
|
58
|
+
|
|
59
|
+
## Contribuir
|
|
60
|
+
|
|
61
|
+
Si deseas contribuir a este proyecto, por favor sigue los siguientes pasos:
|
|
62
|
+
|
|
63
|
+
1. Haz un fork del repositorio.
|
|
64
|
+
2. Crea una nueva rama (`git checkout -b feature/nueva-funcionalidad`).
|
|
65
|
+
3. Realiza tus cambios y haz commit (`git commit -am 'Agrega nueva funcionalidad'`).
|
|
66
|
+
4. Sube tus cambios a tu fork (`git push origin feature/nueva-funcionalidad`).
|
|
67
|
+
5. Abre un Pull Request.
|
|
68
|
+
|
|
69
|
+
## Licencia
|
|
70
|
+
|
|
71
|
+
Este proyecto está bajo la Licencia MIT. Consulta el archivo `LICENSE` para más detalles.
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// #!/usr/bin/env node
|
|
3
|
+
"use strict";
|
|
4
|
+
var __create = Object.create;
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
20
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
21
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
22
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
23
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
24
|
+
mod
|
|
25
|
+
));
|
|
26
|
+
|
|
27
|
+
// src/index.ts
|
|
28
|
+
var import_chalk4 = __toESM(require("chalk"));
|
|
29
|
+
var import_commander = require("commander");
|
|
30
|
+
|
|
31
|
+
// src/commands/help.ts
|
|
32
|
+
var import_chalk = __toESM(require("chalk"));
|
|
33
|
+
function helpCommand() {
|
|
34
|
+
console.log(import_chalk.default.blue("-".repeat(48)));
|
|
35
|
+
console.log(import_chalk.default.bold.green("klei CLI - Ayuda"));
|
|
36
|
+
console.log(import_chalk.default.yellow(`
|
|
37
|
+
Comandos disponibles:
|
|
38
|
+
|
|
39
|
+
saludar <nombre> Saluda al usuario.
|
|
40
|
+
|
|
41
|
+
help Muestra la ayuda y los comandos disponibles.
|
|
42
|
+
|
|
43
|
+
Uso:
|
|
44
|
+
klei <comando>
|
|
45
|
+
|
|
46
|
+
Ejemplos:
|
|
47
|
+
klei saludar <nombre> - Saluda al usuario.
|
|
48
|
+
klei help - Muestra la ayuda.
|
|
49
|
+
`));
|
|
50
|
+
console.log(import_chalk.default.blue("-".repeat(48)));
|
|
51
|
+
}
|
|
52
|
+
var help_default = helpCommand;
|
|
53
|
+
|
|
54
|
+
// src/commands/saludar.ts
|
|
55
|
+
var import_chalk2 = __toESM(require("chalk"));
|
|
56
|
+
var saludar_default = (program2) => {
|
|
57
|
+
program2.command("saludar <nombre>").description("Saluda al usuario").option("-e, --exclamar", "Agrega una exclamaci\xF3n").action((nombre, options) => {
|
|
58
|
+
let mensaje = `Hola ${import_chalk2.default.green(nombre)}!`;
|
|
59
|
+
if (options.exclamar) mensaje += " \u{1F44B}";
|
|
60
|
+
console.log(mensaje);
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
// src/utils/banner.ts
|
|
65
|
+
var import_chalk3 = __toESM(require("chalk"));
|
|
66
|
+
var import_figlet = __toESM(require("figlet"));
|
|
67
|
+
var printBanner = () => {
|
|
68
|
+
console.log(
|
|
69
|
+
import_chalk3.default.blue(
|
|
70
|
+
import_figlet.default.textSync("KLEI", { horizontalLayout: "full" })
|
|
71
|
+
)
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
// src/index.ts
|
|
76
|
+
printBanner();
|
|
77
|
+
import_commander.program.name("klei").version("1.0.0").description("CLI profesional con m\xFAltiples caracter\xEDsticas");
|
|
78
|
+
import_commander.program.command("help").description("Muestra ayuda en espa\xF1ol").action(help_default);
|
|
79
|
+
saludar_default(import_commander.program);
|
|
80
|
+
import_commander.program.configureOutput({
|
|
81
|
+
outputError: (err) => {
|
|
82
|
+
console.error(import_chalk4.default.red(`Error: ${err}`));
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
import_commander.program.parse(process.argv);
|
package/bin/cli.mjs
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// #!/usr/bin/env node
|
|
3
|
+
|
|
4
|
+
// src/index.ts
|
|
5
|
+
import chalk4 from "chalk";
|
|
6
|
+
import { program } from "commander";
|
|
7
|
+
|
|
8
|
+
// src/commands/help.ts
|
|
9
|
+
import chalk from "chalk";
|
|
10
|
+
function helpCommand() {
|
|
11
|
+
console.log(chalk.blue("-".repeat(48)));
|
|
12
|
+
console.log(chalk.bold.green("klei CLI - Ayuda"));
|
|
13
|
+
console.log(chalk.yellow(`
|
|
14
|
+
Comandos disponibles:
|
|
15
|
+
|
|
16
|
+
saludar <nombre> Saluda al usuario.
|
|
17
|
+
|
|
18
|
+
help Muestra la ayuda y los comandos disponibles.
|
|
19
|
+
|
|
20
|
+
Uso:
|
|
21
|
+
klei <comando>
|
|
22
|
+
|
|
23
|
+
Ejemplos:
|
|
24
|
+
klei saludar <nombre> - Saluda al usuario.
|
|
25
|
+
klei help - Muestra la ayuda.
|
|
26
|
+
`));
|
|
27
|
+
console.log(chalk.blue("-".repeat(48)));
|
|
28
|
+
}
|
|
29
|
+
var help_default = helpCommand;
|
|
30
|
+
|
|
31
|
+
// src/commands/saludar.ts
|
|
32
|
+
import chalk2 from "chalk";
|
|
33
|
+
var saludar_default = (program2) => {
|
|
34
|
+
program2.command("saludar <nombre>").description("Saluda al usuario").option("-e, --exclamar", "Agrega una exclamaci\xF3n").action((nombre, options) => {
|
|
35
|
+
let mensaje = `Hola ${chalk2.green(nombre)}!`;
|
|
36
|
+
if (options.exclamar) mensaje += " \u{1F44B}";
|
|
37
|
+
console.log(mensaje);
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// src/utils/banner.ts
|
|
42
|
+
import chalk3 from "chalk";
|
|
43
|
+
import figlet from "figlet";
|
|
44
|
+
var printBanner = () => {
|
|
45
|
+
console.log(
|
|
46
|
+
chalk3.blue(
|
|
47
|
+
figlet.textSync("KLEI", { horizontalLayout: "full" })
|
|
48
|
+
)
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// src/index.ts
|
|
53
|
+
printBanner();
|
|
54
|
+
program.name("klei").version("1.0.0").description("CLI profesional con m\xFAltiples caracter\xEDsticas");
|
|
55
|
+
program.command("help").description("Muestra ayuda en espa\xF1ol").action(help_default);
|
|
56
|
+
saludar_default(program);
|
|
57
|
+
program.configureOutput({
|
|
58
|
+
outputError: (err) => {
|
|
59
|
+
console.error(chalk4.red(`Error: ${err}`));
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
program.parse(process.argv);
|
package/package.json
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "klei-cli",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "cli for creating and managing packages",
|
|
5
|
+
"funding": {
|
|
6
|
+
"type": "buymeacoffee",
|
|
7
|
+
"url": "https://www.buymeacoffee.com/kreisler"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"start": "node ./bin/cli.js",
|
|
11
|
+
"w": "tsup --entry.cli src/index.ts --watch --onSuccess \"node bin/cli.js\"",
|
|
12
|
+
"b": "rm -rf bin/** && tsup",
|
|
13
|
+
"n:latest": "npm install -g npm@latest",
|
|
14
|
+
"p:latest": "pnpm add -g pnpm",
|
|
15
|
+
"p:update": "corepack install -g pnpm@10.4.1",
|
|
16
|
+
"pp": "npm publish --access public",
|
|
17
|
+
"n:cache": "npm config get cache"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"bin/**"
|
|
21
|
+
],
|
|
22
|
+
"main": "bin/cli.js",
|
|
23
|
+
"bin": {
|
|
24
|
+
"klei": "./bin/cli.js"
|
|
25
|
+
},
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git+https://github.com/itskreisler/klei.git"
|
|
29
|
+
},
|
|
30
|
+
"homepage": "https://github.com/itskreisler/klei#readme",
|
|
31
|
+
"bugs": {
|
|
32
|
+
"url": "https://github.com/itskreisler/klei/issues"
|
|
33
|
+
},
|
|
34
|
+
"keywords": [
|
|
35
|
+
"cli",
|
|
36
|
+
"packages"
|
|
37
|
+
],
|
|
38
|
+
"author": "kreisler <tempkreisler@outlook.com> (https://linktr.ee/itskreisler)",
|
|
39
|
+
"contributors": [
|
|
40
|
+
{
|
|
41
|
+
"name": "Kreisler Ramirez Sierra",
|
|
42
|
+
"email": "tempkreisler@outlook.com",
|
|
43
|
+
"url": "https://linktr.ee/itskreisler"
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
"license": "MIT",
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@eslint/js": "^9.21.0",
|
|
49
|
+
"@types/assert": "^1.5.11",
|
|
50
|
+
"@types/figlet": "^1.7.0",
|
|
51
|
+
"@types/node": "^22.13.5",
|
|
52
|
+
"eslint": "^9.21.0",
|
|
53
|
+
"tsup": "^8.3.6",
|
|
54
|
+
"typescript": "^5.7.3",
|
|
55
|
+
"typescript-eslint": "^8.25.0"
|
|
56
|
+
},
|
|
57
|
+
"packageManager": "pnpm@10.4.1+sha512.c753b6c3ad7afa13af388fa6d808035a008e30ea9993f58c6663e2bc5ff21679aa834db094987129aa4d488b86df57f7b634981b2f827cdcacc698cc0cfb88af",
|
|
58
|
+
"pnpm": {
|
|
59
|
+
"onlyBuiltDependencies": [
|
|
60
|
+
"esbuild"
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
"dependencies": {
|
|
64
|
+
"chalk": "^5.4.1",
|
|
65
|
+
"commander": "^13.1.0",
|
|
66
|
+
"figlet": "^1.8.0"
|
|
67
|
+
}
|
|
68
|
+
}
|