-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathverify.ts
28 lines (24 loc) · 987 Bytes
/
verify.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { from, Observable, zip } from 'rxjs';
import { tap } from 'rxjs/operators';
import { FotingoCommand } from 'src/cli/FotingoCommand';
import { Emoji } from 'src/io/messenger';
import { RemoteUser, User } from 'src/types';
export class Verify extends FotingoCommand<[RemoteUser, User], void> {
static description = 'Verify that fotingo can authenticate with the remote services';
protected getCommandData(): Observable<void> | void {
return undefined;
}
protected getValidations(_: Observable<void>): [() => Observable<boolean>, string][] {
return [];
}
protected runCmd(_: Observable<void>): Observable<[RemoteUser, User]> {
return zip(from(this.github.getAuthenticatedUser()), this.tracker.getCurrentUser()).pipe(
tap(([remoteUser, trackerUser]) => {
this.messenger.emit(
`Logged in: "${trackerUser.displayName}" @ ${this.tracker.name} and "${remoteUser.login}" @ Github`,
Emoji.OK,
);
}),
);
}
}