diff options
Diffstat (limited to 'src/tools/resync-remote-user.ts')
| -rw-r--r-- | src/tools/resync-remote-user.ts | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/src/tools/resync-remote-user.ts b/src/tools/resync-remote-user.ts index c9d1ed588c..497bb89f36 100644 --- a/src/tools/resync-remote-user.ts +++ b/src/tools/resync-remote-user.ts @@ -6,22 +6,26 @@ async function main(acct: string): Promise<any> { await resolveUser(username, host, {}, true); } -// get args -const args = process.argv.slice(2); -let acct = args[0]; - -// normalize args -acct = acct.replace(/^@/, ''); - -// check args -if (!acct.match(/^\w+@\w/)) { - throw `Invalid acct format. Valid format are user@host`; +export default () => { + // get args + const args = process.argv.slice(3); + let acct = args[0]; + + // normalize args + acct = acct.replace(/^@/, ''); + + // check args + if (!acct.match(/^\w+@\w/)) { + throw `Invalid acct format. Valid format are user@host`; + } + + console.log(`resync ${acct}`); + + main(acct).then(() => { + console.log('Done'); + process.exit(0); + }).catch(e => { + console.warn(e); + process.exit(1); + }); } - -console.log(`resync ${acct}`); - -main(acct).then(() => { - console.log('Done'); -}).catch(e => { - console.warn(e); -}); |