diff options
-rw-r--r-- | man/ideviceinstaller.1 | 3 | ||||
-rw-r--r-- | src/ideviceinstaller.c | 22 |
2 files changed, 24 insertions, 1 deletions
diff --git a/man/ideviceinstaller.1 b/man/ideviceinstaller.1 index 8d2a01d..8ede2db 100644 --- a/man/ideviceinstaller.1 +++ b/man/ideviceinstaller.1 @@ -31,6 +31,9 @@ list apps installed on the device. .RS .B Additional options: .TP +\-b <bundleID> +Only query for given bundle identifier (can be passed multiple times) +.TP \-o list_user list user apps only (apps installed by the user) .B This is the default. diff --git a/src/ideviceinstaller.c b/src/ideviceinstaller.c index 69ccf29..d80f04d 100644 --- a/src/ideviceinstaller.c +++ b/src/ideviceinstaller.c @@ -120,6 +120,7 @@ int command_completed = 0; int ignore_events = 0; int err_occurred = 0; int notified = 0; +plist_t bundle_ids = NULL; static void print_apps_header() { @@ -400,6 +401,8 @@ static void print_usage(int argc, char **argv) " -u, --udid UDID\tTarget specific device by UDID.\n" " -n, --network\t\tConnect to network device.\n" " -l, --list-apps\tList apps, possible options:\n" + " -b, --bundle-identifier\tOnly query for given bundle identifier\n" + " (can be passed multiple times)\n" " -o list_user\t- list user apps only (this is the default)\n" " -o list_system\t- list system apps only\n" " -o list_all\t- list all types of apps\n" @@ -448,12 +451,13 @@ static void parse_opts(int argc, char **argv) { "notify-wait", no_argument, NULL, 'w' }, { "debug", no_argument, NULL, 'd' }, { "version", no_argument, NULL, 'v' }, + { "bundle-identifier", required_argument, NULL, 'b' }, { NULL, 0, NULL, 0 } }; int c; while (1) { - c = getopt_long(argc, argv, "hU:li:u:g:La:r:R:o:nwdv", longopts, + c = getopt_long(argc, argv, "hU:li:u:g:La:r:R:o:nwdvb:", longopts, (int *) 0); if (c == -1) { break; @@ -493,6 +497,17 @@ static void parse_opts(int argc, char **argv) case 'n': use_network = 1; break; + case 'b': + if (!*optarg) { + printf("ERROR: bundle identifier must not be empty!\n"); + print_usage(argc, argv); + exit(2); + } + if (bundle_ids == NULL) { + bundle_ids = plist_new_array(); + } + plist_array_append_item(bundle_ids, plist_new_string(optarg)); + break; case 'l': cmd = CMD_LIST_APPS; break; @@ -776,6 +791,10 @@ run_again: free(opts); } + if (bundle_ids) { + plist_dict_set_item(client_opts, "BundleIDs", plist_copy(bundle_ids)); + } + if (!xml_mode) { instproxy_client_options_set_return_attributes(client_opts, "CFBundleIdentifier", @@ -1499,6 +1518,7 @@ leave_cleanup: free(appid); free(options); free(bundleidentifier); + plist_free(bundle_ids); if (err_occurred && !res) { res = 128; |