@aiusage/cli 0.4.6 → 0.4.7
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/cli.js +4 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2141,16 +2141,16 @@ async function runSync(flags) {
|
|
|
2141
2141
|
let config = await readConfig(), allTargets = config.targets ?? [];
|
|
2142
2142
|
if (allTargets.length === 0)
|
|
2143
2143
|
throw new Error("\u672A\u914D\u7F6E\u4EFB\u4F55\u4E0A\u62A5\u76EE\u6807\uFF0C\u8BF7\u5148\u6267\u884C aiusage enroll");
|
|
2144
|
-
let deviceId = resolveRequiredString(void 0, config.deviceId, "\u7F3A\u5C11 deviceId\uFF0C\u8BF7\u5148\u6267\u884C enroll"), targetName = resolveOptionalString(flags.target, void 0), targets = targetName ? [findTargetOrThrow(config, targetName)] : allTargets, requestedDate = typeof flags.date == "string" ? flags.date : void 0, fromDate = typeof flags.from == "string" ? flags.from : void 0, toDate = typeof flags.to == "string" ? flags.to : void 0,
|
|
2144
|
+
let deviceId = resolveRequiredString(void 0, config.deviceId, "\u7F3A\u5C11 deviceId\uFF0C\u8BF7\u5148\u6267\u884C enroll"), targetName = resolveOptionalString(flags.target, void 0), targets = targetName ? [findTargetOrThrow(config, targetName)] : allTargets, requestedDate = typeof flags.date == "string" ? flags.date : void 0, fromDate = typeof flags.from == "string" ? flags.from : void 0, toDate = typeof flags.to == "string" ? flags.to : void 0, targetDates;
|
|
2145
2145
|
if (requestedDate)
|
|
2146
2146
|
targetDates = [requestedDate];
|
|
2147
2147
|
else if (fromDate)
|
|
2148
|
-
targetDates = buildDateRange(fromDate, toDate ??
|
|
2148
|
+
targetDates = buildDateRange(fromDate, toDate ?? getTodayDate());
|
|
2149
2149
|
else {
|
|
2150
2150
|
let lookbackDays = typeof flags.lookback == "string" ? parsePositiveInt2(flags.lookback, "--lookback") : defaultLookbackDays(config);
|
|
2151
|
-
targetDates = getClosedDates(lookbackDays),
|
|
2151
|
+
targetDates = getClosedDates(lookbackDays), targetDates.push(getTodayDate());
|
|
2152
2152
|
}
|
|
2153
|
-
console.log(`\u626B\u63CF ${targetDates.length} \u5929 (${targetDates[0]} ~ ${targetDates[targetDates.length - 1]})
|
|
2153
|
+
console.log(`\u626B\u63CF ${targetDates.length} \u5929 (${targetDates[0]} ~ ${targetDates[targetDates.length - 1]}) ...`);
|
|
2154
2154
|
let allDays = (await scanDates(targetDates, { projectAliases: config.projectAliases })).filter((r) => r.breakdowns.length > 0).map((r) => ({ usageDate: r.usageDate, breakdowns: r.breakdowns }));
|
|
2155
2155
|
if (allDays.length === 0) {
|
|
2156
2156
|
console.log("\u6CA1\u6709\u53EF\u4E0A\u4F20\u7684\u6570\u636E\u3002");
|