minara 0.4.4 → 0.4.5
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/dist/commands/discover.js +38 -11
- package/package.json +1 -1
|
@@ -21,9 +21,21 @@ function flattenStock(item) {
|
|
|
21
21
|
const trendingCmd = new Command('trending')
|
|
22
22
|
.description('View trending tokens or stocks')
|
|
23
23
|
.argument('[category]', 'tokens or stocks (default: interactive)')
|
|
24
|
-
.
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
.option('-t, --type <category>', 'Trending type: tokens or stocks (skips interactive prompt)')
|
|
25
|
+
.action(wrapAction(async (categoryArg, options) => {
|
|
26
|
+
let category;
|
|
27
|
+
const typeOpt = options?.type?.toLowerCase() || categoryArg?.toLowerCase();
|
|
28
|
+
if (typeOpt === 'tokens' || typeOpt === 'token') {
|
|
29
|
+
category = 'tokens';
|
|
30
|
+
}
|
|
31
|
+
else if (typeOpt === 'stocks' || typeOpt === 'stock') {
|
|
32
|
+
category = 'stocks';
|
|
33
|
+
}
|
|
34
|
+
else if (!process.stdin.isTTY) {
|
|
35
|
+
// Non-interactive mode: default to tokens
|
|
36
|
+
category = 'tokens';
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
27
39
|
category = await select({
|
|
28
40
|
message: 'Trending:',
|
|
29
41
|
choices: [
|
|
@@ -68,15 +80,30 @@ const trendingCmd = new Command('trending')
|
|
|
68
80
|
const searchCmd = new Command('search')
|
|
69
81
|
.description('Search for tokens or stocks')
|
|
70
82
|
.argument('[keyword]', 'Search keyword')
|
|
71
|
-
.
|
|
83
|
+
.option('-t, --type <category>', 'Search type: tokens or stocks (skips interactive prompt)')
|
|
84
|
+
.action(wrapAction(async (keywordArg, options) => {
|
|
72
85
|
const keyword = keywordArg ?? await input({ message: 'Search keyword:' });
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
86
|
+
let category;
|
|
87
|
+
const typeOpt = options?.type?.toLowerCase();
|
|
88
|
+
if (typeOpt === 'tokens' || typeOpt === 'token') {
|
|
89
|
+
category = 'tokens';
|
|
90
|
+
}
|
|
91
|
+
else if (typeOpt === 'stocks' || typeOpt === 'stock') {
|
|
92
|
+
category = 'stocks';
|
|
93
|
+
}
|
|
94
|
+
else if (!process.stdin.isTTY) {
|
|
95
|
+
// Non-interactive mode: default to tokens
|
|
96
|
+
category = 'tokens';
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
category = await select({
|
|
100
|
+
message: 'Search in:',
|
|
101
|
+
choices: [
|
|
102
|
+
{ name: 'Tokens (crypto)', value: 'tokens' },
|
|
103
|
+
{ name: 'Stocks', value: 'stocks' },
|
|
104
|
+
],
|
|
105
|
+
});
|
|
106
|
+
}
|
|
80
107
|
const spin = spinner(`Searching ${category}…`);
|
|
81
108
|
const res = category === 'tokens'
|
|
82
109
|
? await searchTokens(keyword)
|