Skip to content

Commit eb908ef

Browse files
eunikolskyshazron
authored andcommitted
Fix parsing the short optional arguments (#357)
This patch fixes parsing of the optional argument to the short options `-l` (for `--list`) and `-w` (for `--download`) to accept the target file/directory on the iOS device. The functionality was already implemented and working with the long version of the options. That is: * `-l /Library` did not work and is fixed now; * `--list=/Library` used to and continues to work; * `--list /Library` did not and does not work (`getopt_long` doesn't support that). The fix is to remove double colons after these short options. A few unused one-letter options were also removed.
1 parent 20265e8 commit eb908ef

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ If you are *not* using a node version manager like [nvm](https://github.com/crea
7777
-r, --uninstall uninstall the app before install (do not use with -m; app cache and data are cleared)
7878
-9, --uninstall_only uninstall the app ONLY. Use only with -1 <bundle_id>
7979
-1, --bundle_id <bundle id> specify bundle id for list and upload
80-
-l, --list list files
80+
-l, --list[=<dir>] list all app files or the specified directory
8181
-o, --upload <file> upload file
82-
-w, --download download app tree
82+
-w, --download[=<path>] download app tree or the specified file/directory
8383
-2, --to <target pathname> use together with up/download file/tree. specify target
8484
-D, --mkdir <dir> make directory on device
8585
-R, --rm <path> remove file or directory on device (directories must be empty)

src/ios-deploy/ios-deploy.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1767,9 +1767,9 @@ void usage(const char* app) {
17671767
@" -r, --uninstall uninstall the app before install (do not use with -m; app cache and data are cleared) \n"
17681768
@" -9, --uninstall_only uninstall the app ONLY. Use only with -1 <bundle_id> \n"
17691769
@" -1, --bundle_id <bundle id> specify bundle id for list and upload\n"
1770-
@" -l, --list list files\n"
1770+
@" -l, --list[=<dir>] list all app files or the specified directory\n"
17711771
@" -o, --upload <file> upload file\n"
1772-
@" -w, --download download app tree\n"
1772+
@" -w, --download[=<path>] download app tree or the specified file/directory\n"
17731773
@" -2, --to <target pathname> use together with up/download file/tree. specify target\n"
17741774
@" -D, --mkdir <dir> make directory on device\n"
17751775
@" -R, --rm <path> remove file or directory on device (directories must be empty)\n"
@@ -1831,7 +1831,7 @@ int main(int argc, char *argv[]) {
18311831
};
18321832
int ch;
18331833

1834-
while ((ch = getopt_long(argc, argv, "VmcdvunNrILeWjD:R:i:b:a:s:t:g:x:p:1:2:o:l::w::9::B::", longopts, NULL)) != -1)
1834+
while ((ch = getopt_long(argc, argv, "VmcdvunrILeD:R:i:b:a:t:p:1:2:o:l:w:9BWjNs:", longopts, NULL)) != -1)
18351835
{
18361836
switch (ch) {
18371837
case 'm':

0 commit comments

Comments
 (0)