-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(android): have --forward accept multiple values (#26)
- Loading branch information
1 parent
998f5e2
commit 7844ea4
Showing
15 changed files
with
124 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,23 @@ | ||
export async function run(args: string[]) { | ||
import { Command } from '../'; | ||
|
||
export async function run(args: ReadonlyArray<string>): Promise<void> { | ||
let cmd: Command; | ||
|
||
if (args.includes('--help') || args.includes('-h')) { | ||
const help = await import('./help'); | ||
return help.run(); | ||
cmd = await import('./help'); | ||
return cmd.run(args); | ||
} | ||
|
||
if (args.includes('--list')) { | ||
const list = await import ('./list'); | ||
process.stdout.write(await list.run(args)); | ||
return; | ||
cmd = await import ('./list'); | ||
return cmd.run(args); | ||
} | ||
|
||
if (args.includes('--sdk-info')) { | ||
const cmd = await import ('./sdk-info'); | ||
cmd = await import ('./sdk-info'); | ||
return cmd.run(args); | ||
} | ||
|
||
const cmd = await import('./run'); | ||
cmd = await import('./run'); | ||
await cmd.run(args); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,18 @@ | ||
import { list } from '../utils/list'; | ||
import { format } from '../utils/list'; | ||
|
||
import { getDeviceTargets, getVirtualTargets } from './utils/list'; | ||
import { getSDK } from './utils/sdk'; | ||
|
||
export async function run(args: string[]) { | ||
export async function run(args: ReadonlyArray<string>): Promise<void> { | ||
process.stdout.write(await list(args)); | ||
} | ||
|
||
export async function list(args: ReadonlyArray<string>): Promise<string> { | ||
const sdk = await getSDK(); | ||
const [ devices, virtualDevices ] = await Promise.all([ | ||
getDeviceTargets(sdk), | ||
getVirtualTargets(sdk), | ||
]); | ||
|
||
return list(args, devices, virtualDevices); | ||
return format(args, devices, virtualDevices); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
export async function run(args: string[]) { | ||
import { Command } from '../'; | ||
|
||
export async function run(args: ReadonlyArray<string>): Promise<void> { | ||
let cmd: Command; | ||
|
||
if (args.includes('--help') || args.includes('-h')) { | ||
const help = await import('./help'); | ||
return help.run(); | ||
cmd = await import('./help'); | ||
return cmd.run(args); | ||
} | ||
|
||
if (args.includes('--list') || args.includes('-l')) { | ||
const list = await import('./list'); | ||
process.stdout.write(await list.run(args)); | ||
return; | ||
cmd = await import('./list'); | ||
return cmd.run(args); | ||
} | ||
|
||
const runCmd = await import('./run'); | ||
return runCmd.run(args); | ||
cmd = await import('./run'); | ||
await cmd.run(args); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
export async function run(args: ReadonlyArray<string>): Promise<void> { | ||
const [iosOutput, androidOutput] = await Promise.all([ | ||
import('./ios/list').then(iosList => iosList.list(args)), | ||
import('./android/list').then(androidList => androidList.list(args)), | ||
]); | ||
|
||
if (!args.includes('--json')) { | ||
process.stdout.write(`iOS\n---\n\n${iosOutput}\n`); | ||
process.stdout.write(`Android\n-------\n\n${androidOutput}`); | ||
} else { | ||
const adjustLines = (output: string) => output.split('\n').map(line => `\t${line}`).join('\n').trim(); | ||
process.stdout.write(` | ||
{ | ||
\t"ios": ${adjustLines(iosOutput)}, | ||
\t"android": ${adjustLines(androidOutput)} | ||
}` | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters