summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvi Levin <avi.levin@samsung.com>2015-06-03 17:48:03 +0300
committerAvi Levin <avi.levin@samsung.com>2015-06-03 17:48:03 +0300
commit1282ce52b4b21a75012721186557ef9506e27f2d (patch)
tree9a3eeced0ab7ca90efbdb9897143046a79ea2959
parent0434d11174866b952b0fde667e999fbe08707098 (diff)
Eolian_info: make help better
Make the printing help more visually pleasent.
-rw-r--r--src/bin/.main.c.swpbin40960 -> 45056 bytes
-rw-r--r--src/bin/main.c63
2 files changed, 41 insertions, 22 deletions
diff --git a/src/bin/.main.c.swp b/src/bin/.main.c.swp
index 541d3c4..46a2159 100644
--- a/src/bin/.main.c.swp
+++ b/src/bin/.main.c.swp
Binary files differ
diff --git a/src/bin/main.c b/src/bin/main.c
index 77ae938..30cf06f 100644
--- a/src/bin/main.c
+++ b/src/bin/main.c
@@ -331,13 +331,45 @@ static Eina_Inlist* _prints_inherits_from_mode(const Eolian_Class *ekl, Eina_Inl
331 class_name, eolian_class_full_name_get(ekl), classes_list); 331 class_name, eolian_class_full_name_get(ekl), classes_list);
332 } 332 }
333 } 333 }
334 eina_iterator_free(lst_i);
335 } 334 }
336 eina_iterator_free(lst); 335 eina_iterator_free(lst);
337 336
338 return classes_list; 337 return classes_list;
339} 338}
340 339
340static void _print_help(const char *program)
341{
342 printf("Usage: %s [options] class_path/class_name...\n", program);
343 printf("Options:\n");
344 printf(" --help/-h Display this information\n");
345 printf(" --output/-o <outFile> Set output filename to <outFile>\n");
346 printf(" --include/-I <includeDir> Add <includeDir> to the list of include dirs for scanning\n");
347 printf(" --scope/-s <scope> Set scope(of classes we will work on) to one of:\n ");
348 _mode *current_m = _modes;
349
350 while(current_m->name_l != NULL )
351 {
352 printf("%s(or %s), ", current_m->name_l, current_m->name_s);
353
354 current_m++;
355 }
356 printf("\n");
357 printf(" --filters/-f <filter1,...> Set filters(the info of the class\n "\
358 "that will be printed) to the list seperated by comma of:\n ");
359 _filter *current_f = _filters;
360
361 while(current_f->name != NULL )
362 {
363 printf("%s, ", current_f->name);
364
365 current_f++;
366 }
367 printf("\n");
368
369 printf("\n For example:\n");
370 printf("eo_info_cmd --scope cl -I /home/avilog/git/efl1/efl/src/lib/ -I /home/avilog/git/efl1/elementary/src/lib/ --f events,file --o test.dot Elm.Layout Elm.Win\n");
371}
372
341int main(int argc, char **argv) 373int main(int argc, char **argv)
342{ 374{
343 int ret = 1; 375 int ret = 1;
@@ -361,10 +393,10 @@ int main(int argc, char **argv)
361 /* These options set a flag. */ 393 /* These options set a flag. */
362 {"verbose", no_argument, 0, 'v'}, 394 {"verbose", no_argument, 0, 'v'},
363 {"help", no_argument, 0, 'h'}, 395 {"help", no_argument, 0, 'h'},
364 {"mode", required_argument, 0, 'm'}, 396 {"scope", required_argument, 0, 's'},
365 {"output", required_argument, 0, 'o'}, 397 {"output", required_argument, 0, 'o'},
366 {"include", required_argument, 0, 'I'}, 398 {"include", required_argument, 0, 'I'},
367 {"filter", required_argument, 0, 'f'}, 399 {"filters", required_argument, 0, 'f'},
368 {0, 0, 0, 0} 400 {0, 0, 0, 0}
369 }; 401 };
370 int long_index =0, opt; 402 int long_index =0, opt;
@@ -376,14 +408,12 @@ int main(int argc, char **argv)
376 case 'h': help = EINA_TRUE; break; 408 case 'h': help = EINA_TRUE; break;
377 case 'o': 409 case 'o':
378 { 410 {
379 printf("setting output to %s\n", optarg);
380 output = optarg; 411 output = optarg;
381 412
382 break; 413 break;
383 } 414 }
384 case 'm': 415 case 's':
385 { 416 {
386 // printf("setting mode to %s\n", optarg);
387 mode = optarg; 417 mode = optarg;
388 418
389 break; 419 break;
@@ -391,7 +421,6 @@ int main(int argc, char **argv)
391 case 'I': 421 case 'I':
392 { 422 {
393 const char *dir = optarg; 423 const char *dir = optarg;
394 // printf("scanning%s\n", optarg);
395 if (!eolian_directory_scan(dir))//todo works even if dir dont exist 424 if (!eolian_directory_scan(dir))//todo works even if dir dont exist
396 { 425 {
397 ERR("Failed to scan %s", dir); 426 ERR("Failed to scan %s", dir);
@@ -405,26 +434,17 @@ int main(int argc, char **argv)
405 434
406 break; 435 break;
407 } 436 }
408 default: help = EINA_TRUE; 437 default: {
438 ERR("Unrecognized option %s\n", argv[optind-1]);
439 help = EINA_TRUE;
440 }
409 } 441 }
410 } 442 }
411 int name_start = optind++, name_end = argc; 443 int name_start = optind++, name_end = argc;
412 444
413 if (help) 445 if (help)
414 { 446 {
415 printf("Usage: %s [-h/--help] [-v/--verbose] [--mode/-m mode] [--class/-c class_path] [--include/-I path] [--output/-o outfile]\n", argv[0]); 447 _print_help(argv[0]);
416 printf(" --help/-h Print that help\n");
417 printf(" --mode/-m choose one of:\n");
418 _mode *current_m = _modes;
419
420 while(current_m->name_l != NULL )
421 {
422 printf("%s or short version: %s\n", current_m->name_l, current_m->name_s);
423
424 current_m++;
425 }
426 printf(" --output/-o Force output filename to 'outfile'\n");
427 ret = 0;
428 goto end; 448 goto end;
429 } 449 }
430 450
@@ -444,7 +464,6 @@ int main(int argc, char **argv)
444 464
445 if(!strcmp(current_f->name, f_names[i])) 465 if(!strcmp(current_f->name, f_names[i]))
446 { 466 {
447 // printf("found the filter %s!\n", f_names[i]);
448 current_f->active = EINA_TRUE; 467 current_f->active = EINA_TRUE;
449 break; 468 break;
450 } 469 }