From 03098f35179f0c1928e8ff426d5cce8e7230662e Mon Sep 17 00:00:00 2001 From: Noah Prail Date: Tue, 3 Sep 2019 16:48:54 -0400 Subject: [PATCH] feat(cli): Add support for uploading multiple APK files at once. ref #6 --- src/cli/index.ts | 3 ++- src/helpers.ts | 7 +++++-- src/index.ts | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/cli/index.ts b/src/cli/index.ts index 9c03761..200d49c 100644 --- a/src/cli/index.ts +++ b/src/cli/index.ts @@ -20,7 +20,8 @@ const argv = yargs }) .option('apk', { alias: 'a', - describe: 'Path to the APK file' + describe: 'Path to the APK file', + type: 'array' }) .config( 'key', diff --git a/src/helpers.ts b/src/helpers.ts index 159632e..b229782 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -14,9 +14,12 @@ export interface IPackageManifest { * Parse the manifest of an APK file * @param apk Path to the APK file */ -export const parseManifest = async (apk: string): Promise => { +export const parseManifest = async ( + apk: string | string[] +): Promise => { debug('> Parsing manifest') - const reader = await ApkReader.open(apk) + const apkFile = typeof apk !== 'string' ? apk[0] : apk + const reader = await ApkReader.open(apkFile) const manifest = await reader.readManifest() debug(`> Detected package name ${manifest.package}`) diff --git a/src/index.ts b/src/index.ts index 0db5308..83a7f0e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -64,7 +64,7 @@ export class Apkup { * ``` */ public async upload ( - apk: string, + apk: string | string[], uploadParams?: IUploadParams ): Promise { const apkPackage = await parseManifest(apk) @@ -108,7 +108,7 @@ export class Apkup { */ public async promote ( promoteParams: IPromoteParams, - apk?: string, + apk?: string | string[], editParams?: IEditParams ) { let edit: IEditParams