nekos 2.0.3 → 3.1.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 +80 -2
- package/bin/nekos.js +37 -0
- package/dist/index.cjs +5 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +5 -1
- package/package.json +6 -1
package/README.md
CHANGED
|
@@ -36,9 +36,48 @@ nekos({ colors: "RANDOM" });
|
|
|
36
36
|
|
|
37
37
|
// Log a cat with a custom gradient
|
|
38
38
|
nekos({ colors: ["#ff00ff", "#00ffff"] });
|
|
39
|
+
|
|
40
|
+
// Log a specific cat with two random gradient colors
|
|
41
|
+
nekos({ id: "sad_cat", colors: ["RANDOM", "RANDOM"] });
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
[ESM Example - demo.js](test/demo.js)
|
|
45
|
+
[CJS Example - demo.cjs](test/demo.cjs)
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## CLI Usage
|
|
50
|
+
|
|
51
|
+
For command line use, either install the package globally or use `npx`.
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Install globally
|
|
55
|
+
npm install -g nekos
|
|
39
56
|
```
|
|
40
57
|
|
|
41
|
-
|
|
58
|
+
### Examples
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# Display a random cat
|
|
62
|
+
nekos
|
|
63
|
+
|
|
64
|
+
# Display a specific cat by ID
|
|
65
|
+
nekos --id my_cat
|
|
66
|
+
|
|
67
|
+
# Display a cat with a rainbow gradient
|
|
68
|
+
nekos --colors RAINBOW
|
|
69
|
+
|
|
70
|
+
# Display a cat with two random gradient colors
|
|
71
|
+
nekos --colors RANDOM RANDOM
|
|
72
|
+
|
|
73
|
+
# Display a specific cat with a custom gradient
|
|
74
|
+
nekos --id sad_cat --colors "#ff00ff" "#00ffff"
|
|
75
|
+
|
|
76
|
+
# You can also use npx without a global installation
|
|
77
|
+
npx nekos --colors "#ff00ff #00ffff"
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
---
|
|
42
81
|
|
|
43
82
|
## API
|
|
44
83
|
|
|
@@ -103,9 +142,48 @@ nekos({ colors: "RANDOM" });
|
|
|
103
142
|
|
|
104
143
|
// カスタムグラデーションで猫を表示
|
|
105
144
|
nekos({ colors: ["#ff00ff", "#00ffff"] });
|
|
145
|
+
|
|
146
|
+
// IDを指定した猫に、2色のランダムなグラデーションを適用
|
|
147
|
+
nekos({ id: "sad_cat", colors: ["RANDOM", "RANDOM"] });
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
[ESM Example - demo.js](test/demo.js)
|
|
151
|
+
[CJS Example - demo.cjs](test/demo.cjs)
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## コマンドラインでの使い方
|
|
156
|
+
|
|
157
|
+
コマンドラインで使うには、パッケージをグローバルインストールするか、`npx`を利用します。
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
# グローバルインストール
|
|
161
|
+
npm install -g nekos
|
|
106
162
|
```
|
|
107
163
|
|
|
108
|
-
|
|
164
|
+
### 実行例
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
# ランダムな猫を表示
|
|
168
|
+
nekos
|
|
169
|
+
|
|
170
|
+
# IDを指定して特定の猫を表示
|
|
171
|
+
nekos --id my_cat
|
|
172
|
+
|
|
173
|
+
# 虹色のグラデーションで猫を表示
|
|
174
|
+
nekos --colors RAINBOW
|
|
175
|
+
|
|
176
|
+
# 2色のランダムなグラデーションで猫を表示
|
|
177
|
+
nekos --colors RANDOM RANDOM
|
|
178
|
+
|
|
179
|
+
# IDを指定した猫にカスタムグラデーションを適用
|
|
180
|
+
nekos --id sad_cat --colors "#ff00ff" "#00ffff"
|
|
181
|
+
|
|
182
|
+
# グローバルインストールなしでnpxを使っても実行できます
|
|
183
|
+
npx nekos --colors "#ff00ff #00ffff"
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
---
|
|
109
187
|
|
|
110
188
|
## API
|
|
111
189
|
|
package/bin/nekos.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { program } from "commander";
|
|
4
|
+
import nekos from "../dist/index.js";
|
|
5
|
+
|
|
6
|
+
program
|
|
7
|
+
.option(
|
|
8
|
+
"-i, --id <id>",
|
|
9
|
+
"Display a specific cat by its ID (filename without .txt)"
|
|
10
|
+
)
|
|
11
|
+
.option(
|
|
12
|
+
"-c, --colors [colors...]",
|
|
13
|
+
'Specify colors (e.g., RANDOM, RAINBOW, #ff00ff, "#ff0000 #00ff00")'
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
program.parse(process.argv);
|
|
17
|
+
|
|
18
|
+
const options = program.opts();
|
|
19
|
+
const nekosOptions = {};
|
|
20
|
+
|
|
21
|
+
if (options.id) {
|
|
22
|
+
nekosOptions.id = options.id;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (options.colors) {
|
|
26
|
+
const finalColors = options.colors.flatMap((colorString) =>
|
|
27
|
+
colorString.split(" ")
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
if (finalColors.length === 1) {
|
|
31
|
+
nekosOptions.colors = finalColors[0];
|
|
32
|
+
} else {
|
|
33
|
+
nekosOptions.colors = finalColors;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
nekos(nekosOptions);
|
package/dist/index.cjs
CHANGED
|
@@ -34,6 +34,7 @@ __export(cjs_entry_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(cjs_entry_exports);
|
|
35
35
|
var import_fs = __toESM(require("fs"));
|
|
36
36
|
var import_path = __toESM(require("path"));
|
|
37
|
+
var import_consola = require("consola");
|
|
37
38
|
var import_color = require("@randplus/color");
|
|
38
39
|
var import_gradient_string = __toESM(require("gradient-string"));
|
|
39
40
|
var aaDir = import_path.default.join(__dirname, "../aa");
|
|
@@ -80,8 +81,11 @@ function nekos(options = {}) {
|
|
|
80
81
|
processedColors = [colors];
|
|
81
82
|
}
|
|
82
83
|
} else if (Array.isArray(colors)) {
|
|
84
|
+
if (colors.includes("RAINBOW")) {
|
|
85
|
+
import_consola.consola.warn("Cannot use the value, 'RAINBOW' in array.");
|
|
86
|
+
}
|
|
83
87
|
processedColors = colors.map(
|
|
84
|
-
(
|
|
88
|
+
(color2) => typeof color2 === "string" && color2.toUpperCase() === "RANDOM" ? (0, import_color.hex)("#") : color2
|
|
85
89
|
);
|
|
86
90
|
} else {
|
|
87
91
|
processedColors = colors;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
type
|
|
1
|
+
type SingleColorKeyword = "RAINBOW";
|
|
2
|
+
type ColorKeyword = "RANDOM";
|
|
2
3
|
type HexColor = `#${string}`;
|
|
3
4
|
type ColorValue = ColorKeyword | HexColor;
|
|
4
5
|
interface NekosOptions {
|
|
5
6
|
id?: string;
|
|
6
|
-
colors?: ColorValue | ColorValue[];
|
|
7
|
+
colors?: SingleColorKeyword | ColorValue | ColorValue[];
|
|
7
8
|
}
|
|
8
9
|
/**
|
|
9
10
|
* Logs a cat ASCII art to the console.
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import fs from "fs";
|
|
3
3
|
import path from "path";
|
|
4
4
|
import { fileURLToPath } from "url";
|
|
5
|
+
import { consola } from "consola";
|
|
5
6
|
import { hex } from "@randplus/color";
|
|
6
7
|
import gradient from "gradient-string";
|
|
7
8
|
var __filename = fileURLToPath(import.meta.url);
|
|
@@ -50,8 +51,11 @@ function nekos(options = {}) {
|
|
|
50
51
|
processedColors = [colors];
|
|
51
52
|
}
|
|
52
53
|
} else if (Array.isArray(colors)) {
|
|
54
|
+
if (colors.includes("RAINBOW")) {
|
|
55
|
+
consola.warn("Cannot use the value, 'RAINBOW' in array.");
|
|
56
|
+
}
|
|
53
57
|
processedColors = colors.map(
|
|
54
|
-
(
|
|
58
|
+
(color2) => typeof color2 === "string" && color2.toUpperCase() === "RANDOM" ? hex("#") : color2
|
|
55
59
|
);
|
|
56
60
|
} else {
|
|
57
61
|
processedColors = colors;
|
package/package.json
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nekos",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Let's have cute cats mess around in the log!",
|
|
5
|
+
"bin": {
|
|
6
|
+
"nekos": "bin/nekos.js"
|
|
7
|
+
},
|
|
5
8
|
"type": "module",
|
|
6
9
|
"main": "dist/index.cjs",
|
|
7
10
|
"module": "dist/index.js",
|
|
@@ -38,6 +41,8 @@
|
|
|
38
41
|
"homepage": "https://github.com/otoneko1102/nekos#readme",
|
|
39
42
|
"dependencies": {
|
|
40
43
|
"@randplus/color": "^3.0.0",
|
|
44
|
+
"commander": "^14.0.0",
|
|
45
|
+
"consola": "^3.4.2",
|
|
41
46
|
"gradient-string": "^3.0.0"
|
|
42
47
|
},
|
|
43
48
|
"devDependencies": {
|