Add -k/--key option. Allow getting more properties of the app (#497)

Add -k/--key option. Allow getting more properties of the app
diff --git a/README.md b/README.md
index 66ec4d5..9666828 100644
--- a/README.md
+++ b/README.md
@@ -85,6 +85,7 @@
 	  -E, --error_output <file>    write stderr to this file
 	  --detect_deadlocks <sec>     start printing backtraces for all threads periodically after specific amount of seconds
 	  -f, --file_system            specify file system for mkdir / list / upload / download / rm
+	  -k, --key                    keys for the properties of the bundle. Joined by '&' and used only with -B <list_bundle_id> and -j <json>
 	  -F, --non-recursively        specify non-recursively walk directory
 	  -j, --json                   format output as JSON
 
@@ -151,6 +152,10 @@
     
     // upload file to /DCIM
     ios-deploy -f -o/Users/ryan/Downloads/test.png -2/DCIM/test.png
+    
+    // get more properties of the bundle
+    ios-deploy -B -j --key=UIFileSharingEnabled&CFBundlePackageType
+
 
 ## Demo
 
diff --git a/src/ios-deploy/ios-deploy.m b/src/ios-deploy/ios-deploy.m
index c3a8975..02b9cd7 100644
--- a/src/ios-deploy/ios-deploy.m
+++ b/src/ios-deploy/ios-deploy.m
@@ -98,6 +98,7 @@
 char const*target_filename = NULL;
 char const*upload_pathname = NULL;
 char *bundle_id = NULL;
+char *key = NULL;
 bool interactive = true;
 bool justlaunch = false;
 bool file_system = false;
@@ -1706,13 +1707,16 @@
 void list_bundle_id(AMDeviceRef device)
 {
     connect_and_start_session(device);
-
-    NSArray *a = [NSArray arrayWithObjects:
-                  @"CFBundleIdentifier",
-                  @"CFBundleName",
-                  @"CFBundleDisplayName",
-                  @"CFBundleVersion",
-                  @"CFBundleShortVersionString", nil];
+    NSMutableArray *a = [NSMutableArray arrayWithObjects:
+                         @"CFBundleIdentifier",
+                         @"CFBundleName",
+                         @"CFBundleDisplayName",
+                         @"CFBundleVersion",
+                         @"CFBundleShortVersionString", nil];
+    if (key) {
+        NSArray * ns_keys = [[NSString stringWithUTF8String:key] componentsSeparatedByString:@"&"];
+        [a addObjectsFromArray:ns_keys];
+    }
     NSDictionary *optionsDict = [NSDictionary dictionaryWithObject:a forKey:@"ReturnAttributes"];
     CFDictionaryRef options = (CFDictionaryRef)optionsDict;
     CFDictionaryRef result = nil;
@@ -2279,6 +2283,7 @@
         @"  -f, --file_system            specify file system for mkdir / list / upload / download / rm\n"
         @"  -F, --non-recursively        specify non-recursively walk directory\n"
         @"  -j, --json                   format output as JSON\n"
+        @"  -k, --key                    keys for the properties of the bundle. Joined by '&' and used only with -B <list_bundle_id> and -j <json> \n"
         @"  --custom-script <script>     path to custom python script to execute in lldb\n"
         @"  --custom-command <command>   specify additional lldb commands to execute\n",
         [NSString stringWithUTF8String:app]);
@@ -2336,13 +2341,14 @@
         { "app_deltas", required_argument, NULL, 'A'},
         { "file_system", no_argument, NULL, 'f'},
         { "non-recursively", no_argument, NULL, 'F'},
+        { "key", optional_argument, NULL, 'k' },
         { "custom-script", required_argument, NULL, 1001},
         { "custom-command", required_argument, NULL, 1002},
         { NULL, 0, NULL, 0 },
     };
     int ch;
 
-    while ((ch = getopt_long(argc, argv, "VmcdvunrILefFD:R:X:i:b:a:t:p:1:2:o:l:w:9BWjNs:OE:CA:", longopts, NULL)) != -1)
+    while ((ch = getopt_long(argc, argv, "VmcdvunrILefFD:R:X:i:b:a:t:p:1:2:o:l:w:9BWjNs:OE:CA:k:", longopts, NULL)) != -1)
     {
         switch (ch) {
         case 'm':
@@ -2488,6 +2494,9 @@
             }
             [custom_commands appendFormat:@"%s\n", optarg];
             break;
+        case 'k':
+            key = optarg;
+            break;
         default:
             usage(argv[0]);
             return exitcode_error;
@@ -2501,7 +2510,7 @@
 
     if (!app_path && !detect_only && !command_only) {
         usage(argv[0]);
-        on_error(@"One of -[b|c|o|l|w|D|R|e|9] is required to proceed!");
+        on_error(@"One of -[b|c|o|l|w|D|R|X|e|B|C|9] is required to proceed!");
     }
 
     if (unbuffered) {