项目初始化
This commit is contained in:
27
aliyun-sync/aliyun-aps-sync/src/index.js
Normal file
27
aliyun-sync/aliyun-aps-sync/src/index.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import { login, scheduleSync, syncAll, syncBillsOnly } from './sync.js';
|
||||
|
||||
const command = process.argv[2] || 'sync';
|
||||
|
||||
if (command === 'login') {
|
||||
await login();
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
if (command === 'sync') {
|
||||
const summary = await syncAll();
|
||||
console.log(JSON.stringify(summary, null, 2));
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
if (command === 'bills') {
|
||||
const summary = await syncBillsOnly();
|
||||
console.log(JSON.stringify(summary, null, 2));
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
if (command === 'schedule') {
|
||||
await scheduleSync();
|
||||
} else {
|
||||
console.error(`不支持的命令: ${command}`);
|
||||
process.exit(1);
|
||||
}
|
||||
Reference in New Issue
Block a user