File tree Expand file tree Collapse file tree 4 files changed +94
-6
lines changed Expand file tree Collapse file tree 4 files changed +94
-6
lines changed Original file line number Diff line number Diff line change @@ -19,12 +19,12 @@ export class CommandExecutor implements ICommandExecutor {
19
19
20
20
private executeCore ( commandName : string , commandArguments : string [ ] ) : IFuture < void > {
21
21
return ( ( ) => {
22
- var command : ICommand = new ( require ( "./commands/" + commandName ) . Command ) ( ) ;
23
- if ( ! command ) {
24
- errors . fail ( "Unable to resolve commandName %s" , commandName ) ;
25
- }
26
-
27
22
try {
23
+ var command : ICommand = new ( require ( "./commands/" + commandName ) . Command ) ( ) ;
24
+ if ( ! command ) {
25
+ errors . fail ( "Unable to resolve commandName %s" , commandName ) ;
26
+ }
27
+
28
28
command . execute ( commandArguments ) . wait ( ) ;
29
29
} catch ( e ) {
30
30
if ( options . debug ) {
Original file line number Diff line number Diff line change
1
+ ///<reference path=".././.d.ts"/>
2
+ "use strict" ;
3
+
4
+ import fs = require( "fs" ) ;
5
+ import path = require( "path" ) ;
6
+ import util = require( "util" ) ;
7
+
8
+ export class Command implements ICommand {
9
+ public execute ( args : string [ ] ) : IFuture < void > {
10
+ return ( ( ) => {
11
+ var topic = ( args [ 0 ] || "" ) . toLowerCase ( ) ;
12
+ if ( topic === "help" ) {
13
+ topic = "" ;
14
+ }
15
+
16
+ var helpContent = fs . readFileSync ( path . join ( __dirname , "../../resources/help.txt" ) ) . toString ( ) ;
17
+
18
+ var pattern = util . format ( "--\\[%s\\]--((.|[\\r\\n])+?)--\\[/\\]--" , this . escape ( topic ) ) ;
19
+ var regex = new RegExp ( pattern ) ;
20
+ var match = regex . exec ( helpContent ) ;
21
+ if ( match ) {
22
+ var helpText = match [ 1 ] . trim ( ) ;
23
+ console . log ( helpText ) ;
24
+ }
25
+ } ) . future < void > ( ) ( ) ;
26
+ }
27
+
28
+ private escape ( s : string ) : string {
29
+ return s . replace ( / [ - \/ \\ ^ $ * + ? . ( ) | [ \] { } ] / g, '\\$&' ) ;
30
+ }
31
+ }
Original file line number Diff line number Diff line change @@ -10,7 +10,8 @@ var knownOptions: any = {
10
10
"stdout" : String ,
11
11
"stderr" : String ,
12
12
"env" : String ,
13
- "args" : String
13
+ "args" : String ,
14
+ "help" : Boolean
14
15
} ;
15
16
16
17
var parsed = { } ;
Original file line number Diff line number Diff line change
1
+ --[]--
2
+
3
+ Usage:
4
+ $ ios-sim-portable <command> [command parameters] [--command <options>]
5
+
6
+ General commands:
7
+ help <command> Shows additional information about the commands in this list.
8
+ launch <App path> Launch the application at the specified path on the iOS Simulator.
9
+ device-types Lists the available device types for current Xcode version.
10
+ sdks Lists the available iOS sdk versions.
11
+
12
+ General options:
13
+ --help Prints help about the selected command.
14
+
15
+ --[/]--
16
+
17
+ --[help]--
18
+
19
+ Usage:
20
+ $ ios-sim-portable help [<Command>]
21
+
22
+ Lists the available commands or shows information about the selected command.
23
+ <Command> is any of the available commands as listed by $ ios-sim-portable help.
24
+
25
+ --[/]--
26
+
27
+ --[launch]--
28
+
29
+ Usage:
30
+ $ ios-sim-portable launch <App path> [--exit]
31
+
32
+ Launch the application at the specified path on iOS Simulator.
33
+ <App path> - Specifies the path to application(.app file) that you want to run in iOS Simulator.
34
+
35
+ Options:
36
+ --exit - If this option is specified, the process is exited after the iOS Simulator is started.
37
+
38
+ --[/]--
39
+
40
+ --[device-types]--
41
+
42
+ Usage:
43
+ $ ios-sim-portable device-types
44
+
45
+ Lists the available device types for current XCode version
46
+
47
+ --[/]--
48
+
49
+ --[sdks]--
50
+
51
+ Usage:
52
+ $ ios-sim-portable sdks
53
+
54
+ Lists the available iOS sdk versions.
55
+
56
+ --[/]--
You can’t perform that action at this time.
0 commit comments