Skip to content

Commit 698f737

Browse files
deralaxoice-chillios
authored andcommitted
[r5n-86] [Hydra] update command (#17)
1 parent 96ead19 commit 698f737

21 files changed

Lines changed: 236 additions & 134 deletions

File tree

bun.lock

Lines changed: 40 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"devDependencies": {
3-
"@biomejs/biome": "2.4.11",
3+
"@biomejs/biome": "2.4.13",
44
"@clack/prompts": "1.2.0",
5-
"@types/bun": "1.3.12",
6-
"lefthook": "2.1.5",
7-
"typescript": "6.0.2"
5+
"@types/bun": "1.3.13",
6+
"lefthook": "2.1.6",
7+
"typescript": "6.0.3"
88
},
99
"license": "Apache-2.0",
1010
"name": "r5n-clis",
@@ -32,5 +32,7 @@
3232
"type-check:go": "bun --elide-lines=0 --filter '*' type-check:go"
3333
},
3434
"version": "0.0.0",
35-
"workspaces": { "packages": ["packages/*", "tools"] }
35+
"workspaces": {
36+
"packages": ["packages/*", "tools"]
37+
}
3638
}

packages/hydra/src/cli.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
import { AbstractCLI, ConfigManager } from "@r5n/cli-core";
22
import { version } from "../package.json";
3-
import { CreateCommand, InitCommand, ProfileCommand, RemoveCommand, StartCommand, StatusCommand, StopCommand } from "./commands";
3+
import {
4+
CreateCommand,
5+
InitCommand,
6+
ProfileCommand,
7+
RemoveCommand,
8+
StartCommand,
9+
StatusCommand,
10+
StopCommand,
11+
UpdateCommand,
12+
} from "./commands";
413
import { CLI_BIN, DEFAULT_CONFIG, HYDRA_CONFIG_FILE } from "./constants";
514
import type { HydraConfig } from "./types";
615

@@ -25,6 +34,7 @@ class HydraCLI extends AbstractCLI {
2534
new StopCommand(),
2635
new StatusCommand(),
2736
new RemoveCommand(),
37+
new UpdateCommand(),
2838
new ProfileCommand(),
2939
]);
3040
}

packages/hydra/src/commands/create.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { join } from "node:path";
2-
import { Exit, color, log, positionals, spinner, text } from "@r5n/cli-core";
2+
import { color, Exit, log, positionals, spinner, text } from "@r5n/cli-core";
33
import { BaseCommand, type Ctx } from "../base-command";
44
import { createProvider } from "../providers";
55
import type { RunnerEntry } from "../types";
@@ -24,7 +24,9 @@ export class CreateCommand extends BaseCommand {
2424

2525
const count = ctx.interactive
2626
? await this.promptCount(profile.numberOfMachines)
27-
: (ctx.positionals.count ? Number.parseInt(ctx.positionals.count, 10) : profile.numberOfMachines);
27+
: ctx.positionals.count
28+
? Number.parseInt(ctx.positionals.count, 10)
29+
: profile.numberOfMachines;
2830

2931
if (!count || count < 1) {
3032
throw new Exit("Runner count must be at least 1");
@@ -73,7 +75,9 @@ export class CreateCommand extends BaseCommand {
7375

7476
const isDefault = profileName === ctx.config.get("defaultProfile");
7577
const profileSuffix = isDefault ? "" : ` ${profileName}`;
76-
log.info(`${color.green("Created")} ${toCreate} runner(s) for "${profileName}". Run ${color.green(`hydra start${profileSuffix}`)} to start them.`);
78+
log.info(
79+
`${color.green("Created")} ${toCreate} runner(s) for "${profileName}". Run ${color.green(`hydra start${profileSuffix}`)} to start them.`,
80+
);
7781
}
7882

7983
private async promptCount(defaultCount: number): Promise<number> {
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
export { CreateCommand } from "./create";
22
export { InitCommand } from "./init";
3-
export { StatusCommand } from "./status";
43
export { ProfileCommand } from "./profile";
54
export { RemoveCommand } from "./remove";
65
export { StartCommand } from "./start";
6+
export { StatusCommand } from "./status";
77
export { StopCommand } from "./stop";
8+
export { UpdateCommand } from "./update";

0 commit comments

Comments
 (0)