Skip to content
This repository was archived by the owner on Sep 4, 2024. It is now read-only.

Commit 12a0709

Browse files
committed
[fix] improved the docs of the baselime rehydrate command
1 parent 949d54f commit 12a0709

File tree

2 files changed

+17
-20
lines changed

2 files changed

+17
-20
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
1010
### Added
1111
- Added baselime mark command
1212

13+
## Changed
14+
- Improved the docs of the baselime rehydrate command
15+
1316
### Removed
1417
- Removed unnecessary options in baselime console command
1518

src/commands/rehydrate.ts

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,25 @@ import api from "../services/api/api";
66
import { promptSelectAccount } from "./rehydrate/prompts";
77

88
export interface Options extends BaseOptions {
9-
config?: string;
10-
startDate?: string;
11-
hoursToRecover?: number;
9+
"start-date"?: string;
10+
"hours-to-recover"?: number;
1211
}
1312

1413
export const command = "rehydrate";
15-
export const desc = "Rehydrate expired data from your s3";
14+
export const desc = "Rehydrate Baselime hot storage with data from your Amazon S3 Bucket";
1615

1716
export const builder: CommandBuilder<Options, Options> = (yargs) => {
1817
return yargs
1918
.options({
2019
...baseOptions,
21-
config: {
22-
type: "string",
23-
desc: "The configuration folder to execute",
24-
alias: "c",
25-
default: ".baselime",
26-
},
27-
startDate: { type: "string", desc: "Date onwards which to recover the data ISO format" },
28-
hoursToRecover: { type: "number", desc: "Consecutive hours of data from startDate to recover" },
20+
"start-date": { type: "string", desc: "Date to start recovering data from, in ISO format" },
21+
"hours-to-recover": { type: "number", desc: "Number of consecutive hours of data to recover starting from start-date. Minimum: 1, maximum: 12", },
2922
})
3023
.example([
3124
[
3225
`
33-
$0 rehydrate --startDate 2023-06-08T13:24:47.906Z --hoursToRecover 1
34-
$0 rehydrate --config .baselime --profile prod --startDate 2023-06-08T13:24:47.906Z --hoursToRecover 1`,
26+
$0 rehydrate --start-date 2023-06-08T13:24:47.906Z --hours-to-recover 1
27+
$0 rehydrate --profile prod --start-date 2023-06-08T13:24:47.906Z --hours-to-recover 9`,
3528
],
3629
])
3730
.fail((message, err, yargs) => {
@@ -40,25 +33,26 @@ export const builder: CommandBuilder<Options, Options> = (yargs) => {
4033
};
4134

4235
export async function handler(argv: Arguments<Options>) {
43-
const { config, profile, startDate, hoursToRecover } = argv;
36+
const { profile, "start-date": startDate, "hours-to-recover": hoursToRecover } = argv;
4437
spinner.init(!!argv.quiet);
4538
await authenticate(profile);
4639
const sd = new Date(startDate as string);
4740
if (isNaN(sd.valueOf())) {
48-
throw new Error("Invalid Date");
41+
throw new Error("Invalid Start date");
4942
}
5043
const htr = Number(hoursToRecover);
5144
if (isNaN(htr) || htr < 1 || htr > 12) {
52-
throw new Error("Invalid hoursToRecover");
45+
throw new Error("Invalid number of hours to recover");
5346
}
5447
const account = await promptSelectAccount();
5548
const s = spinner.get();
56-
s.start("Requesting rehydration");
57-
const result = await api.rehydrate({
49+
s.start("Requesting data rehydration");
50+
51+
await api.rehydrate({
5852
startDate: sd,
5953
hoursToRecover: htr,
6054
accountId: account.id,
6155
region: account.region,
6256
});
63-
s.succeed();
57+
s.succeed("Rehydration started");
6458
}

0 commit comments

Comments
 (0)