Skip to content

Commit 4fdf977

Browse files
✨ Add CLI
1 parent 4d3720e commit 4fdf977

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

src/cli.ts

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env node
2+
import {
3+
Spotify,
4+
Rescuetime,
5+
LastFm,
6+
PocketCasts,
7+
Wakatime,
8+
Clockify,
9+
GoogleFit,
10+
OuraRing,
11+
Goodreads,
12+
Twitter,
13+
} from "./";
14+
15+
const cli = async () => {
16+
const command = process.argv[2];
17+
if (command === "migrate") {
18+
const integration = process.argv[3];
19+
if (!integration) throw new Error("Provide an integration");
20+
const start = process.argv[4];
21+
if (!start) throw new Error("Provide a start date");
22+
23+
[Spotify, Rescuetime, LastFm, PocketCasts, Wakatime, Clockify, GoogleFit, OuraRing, Goodreads, Twitter].forEach(
24+
(ClassName) => {
25+
const integrationObject = new ClassName();
26+
if (integration === integrationObject.name) {
27+
integrationObject.legacy(start);
28+
}
29+
}
30+
);
31+
} else {
32+
throw new Error(`CLI command '${command}' not recognized`);
33+
}
34+
};
35+
36+
cli();

0 commit comments

Comments
 (0)