Skip to content

Commit 19aeefc

Browse files
committed
todo: fix choices
1 parent 17f84f0 commit 19aeefc

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

scripts/generate-cli-docs-v2.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import { ActorsCallCommand } from '../src/commands/actors/call';
2+
import { TopLevelCallCommand } from '../src/commands/call';
3+
import { LoginCommand } from '../src/commands/login';
4+
import { LogoutCommand } from '../src/commands/logout';
5+
import type { BuiltApifyCommand } from '../src/lib/command-framework/apify-command';
6+
import type { BaseCommandRenderer } from '../src/lib/command-framework/help/_BaseCommandRenderer';
7+
8+
interface CommandsInCategory extends Partial<Parameters<BaseCommandRenderer['selectiveRender']>[0]> {
9+
command: typeof BuiltApifyCommand;
10+
aliases?: (typeof BuiltApifyCommand)[];
11+
}
12+
13+
const Commands = {
14+
call: TopLevelCallCommand,
15+
login: LoginCommand,
16+
logout: LogoutCommand,
17+
actorsCall: ActorsCallCommand,
18+
};
19+
20+
// render description in code block, then usage, no short description after command header
21+
22+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
23+
const categories: Record<string, CommandsInCategory[]> = {
24+
'auth-commands': [
25+
//
26+
{ command: Commands.login },
27+
{ command: Commands.logout },
28+
{ command: Commands.actorsCall, aliases: [Commands.call] },
29+
],
30+
'actor-commands': [
31+
//
32+
{ command: Commands.call, aliases: [Commands.call] },
33+
],
34+
'general-commands': [
35+
//
36+
],
37+
'dataset-commands': [
38+
//
39+
],
40+
'key-value-store-commands': [
41+
//
42+
],
43+
};

src/lib/command-framework/help/CommandHelp.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ DESCRIPTION
3434
GLOBAL FLAGS
3535
--json Format output as json.
3636
37+
USAGE
38+
$ apify login [-t <value>] [-m console|manual]
39+
40+
FLAGS
41+
-m, --method=<option> [Optional] Method of logging in to Apify
42+
<options: console|manual>
43+
-t, --token=<value> [Optional] Apify API token
44+
3745
*/
3846

3947
export class CommandHelp extends BaseCommandRenderer {

0 commit comments

Comments
 (0)