From 40e7f3d9009e8caaa42b3033a69177635f39d111 Mon Sep 17 00:00:00 2001 From: tilakpatidar Date: Sun, 6 Jan 2019 16:12:23 +0530 Subject: [PATCH] pr: add -J and -S option pr: add -J option pr: add -S option --- src/pr/pr.rs | 105 +++++++--- .../pr/column_across_sep1.log.expected | 198 ++++++++++++++++++ tests/fixtures/pr/joined.log.expected | 132 ++++++++++++ tests/test_pr.rs | 31 +++ 4 files changed, 433 insertions(+), 33 deletions(-) create mode 100644 tests/fixtures/pr/column_across_sep1.log.expected create mode 100644 tests/fixtures/pr/joined.log.expected diff --git a/src/pr/pr.rs b/src/pr/pr.rs index f463a9890..f60d24a4c 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -57,9 +57,11 @@ static COLUMN_WIDTH_OPTION: &str = "w"; static PAGE_WIDTH_OPTION: &str = "W"; static ACROSS_OPTION: &str = "a"; static COLUMN_OPTION: &str = "column"; -static COLUMN_SEPARATOR_OPTION: &str = "s"; +static COLUMN_CHAR_SEPARATOR_OPTION: &str = "s"; +static COLUMN_STRING_SEPARATOR_OPTION: &str = "S"; static MERGE_FILES_PRINT: &str = "m"; static OFFSET_SPACES_OPTION: &str = "o"; +static JOIN_LINES_OPTION: &str = "J"; static FILE_STDIN: &str = "-"; static READ_BUFFER_SIZE: usize = 1024 * 64; static DEFAULT_COLUMN_WIDTH: usize = 72; @@ -87,6 +89,7 @@ struct OutputOptions { offset_spaces: usize, form_feed_used: bool, page_width: Option, + join_lines: bool, } struct FileLine { @@ -332,8 +335,8 @@ pub fn uumain(args: Vec) -> i32 { ); opts.opt( - COLUMN_SEPARATOR_OPTION, - "", + COLUMN_CHAR_SEPARATOR_OPTION, + "separator", "Separate text columns by the single character char instead of by the appropriate number of s (default for char is the character).", "char", @@ -341,6 +344,17 @@ pub fn uumain(args: Vec) -> i32 { Occur::Optional, ); + opts.opt( + COLUMN_STRING_SEPARATOR_OPTION, + "sep-string", + "separate columns by STRING, + without -S: Default separator with -J and + otherwise (same as -S\" \"), no effect on column options", + "string", + HasArg::Yes, + Occur::Optional, + ); + opts.opt( MERGE_FILES_PRINT, "merge", @@ -362,6 +376,16 @@ pub fn uumain(args: Vec) -> i32 { Occur::Optional, ); + opts.opt( + JOIN_LINES_OPTION, + "join-lines", + "merge full lines, turns off -W line truncation, no column + alignment, --sep-string[=STRING] sets separators", + "offset", + HasArg::No, + Occur::Optional, + ); + opts.optflag("", "help", "display this help and exit"); opts.optflag("V", "version", "output version information and exit"); @@ -648,10 +672,10 @@ fn build_options( x[0].to_string() }) .map(invalid_pages_map) - { - Some(res) => res?, - _ => start_page_in_plus_option, - }; + { + Some(res) => res?, + _ => start_page_in_plus_option, + }; let end_page: Option = match matches .opt_str(PAGE_RANGE_OPTION) @@ -661,10 +685,10 @@ fn build_options( x[1].to_string() }) .map(invalid_pages_map) - { - Some(res) => Some(res?), - _ => end_page_in_plus_option, - }; + { + Some(res) => Some(res?), + _ => end_page_in_plus_option, + }; if end_page.is_some() && start_page > end_page.unwrap() { return Err(PrError::EncounteredErrors(format!( @@ -699,12 +723,15 @@ fn build_options( let across_mode: bool = matches.opt_present(ACROSS_OPTION); - let column_separator: String = matches - .opt_str(COLUMN_SEPARATOR_OPTION) + let column_separator: String = match matches.opt_str(COLUMN_STRING_SEPARATOR_OPTION) + { + Some(x) => Some(x), + None => matches.opt_str(COLUMN_CHAR_SEPARATOR_OPTION), + } .unwrap_or(DEFAULT_COLUMN_SEPARATOR.to_string()); let default_column_width = if matches.opt_present(COLUMN_WIDTH_OPTION) - && matches.opt_present(COLUMN_SEPARATOR_OPTION) + && matches.opt_present(COLUMN_CHAR_SEPARATOR_OPTION) { DEFAULT_COLUMN_WIDTH_WITH_S_OPTION } else { @@ -713,9 +740,14 @@ fn build_options( let column_width: usize = parse_usize(matches, COLUMN_WIDTH_OPTION).unwrap_or(Ok(default_column_width))?; - let page_width: Option = match parse_usize(matches, PAGE_WIDTH_OPTION) { - Some(res) => Some(res?), - None => None, + + let page_width: Option = if matches.opt_present(JOIN_LINES_OPTION) { + None + } else { + match parse_usize(matches, PAGE_WIDTH_OPTION) { + Some(res) => Some(res?), + None => None, + } }; let re_col = Regex::new(r"\s*-(\d+)\s*").unwrap(); @@ -748,6 +780,8 @@ fn build_options( }; let offset_spaces: usize = parse_usize(matches, OFFSET_SPACES_OPTION).unwrap_or(Ok(0))?; + let join_lines: bool = matches.opt_present(JOIN_LINES_OPTION); + Ok(OutputOptions { number: numbering_options, header, @@ -766,6 +800,7 @@ fn build_options( offset_spaces, form_feed_used, page_width, + join_lines, }) } @@ -1133,7 +1168,7 @@ fn write_columns( options.content_lines_per_page }; - let width: usize = options.number.as_ref().map(|i| i.width).unwrap_or(0); + let number_width: usize = options.number.as_ref().map(|i| i.width).unwrap_or(0); let number_separator: String = options .number .as_ref() @@ -1168,6 +1203,18 @@ fn write_columns( let page_width: Option = options.page_width; + let line_width: Option = if options.join_lines { + None + } else if columns > 1 { + options + .column_mode_options + .as_ref() + .map(|i| Some(i.width)) + .unwrap_or(Some(DEFAULT_COLUMN_WIDTH)) + } else { + options.page_width + }; + let across_mode = options .column_mode_options .as_ref() @@ -1208,18 +1255,17 @@ fn write_columns( spaces, get_line_for_printing( file_line, - &width, + &number_width, &number_separator, columns, - col_width, is_number_mode, &options.merge_files_print, &i, - page_width + line_width, ) ); out.write(trimmed_line.as_bytes())?; - if (i + 1) != indexes { + if (i + 1) != indexes && !options.join_lines { out.write(col_sep.as_bytes())?; } lines_printed += 1; @@ -1235,20 +1281,19 @@ fn write_columns( fn get_line_for_printing( file_line: &FileLine, - width: &usize, + number_width: &usize, separator: &String, columns: usize, - col_width: Option, is_number_mode: bool, merge_files_print: &Option, index: &usize, - page_width: Option, + line_width: Option, ) -> String { let should_show_line_number_merge_file = merge_files_print.is_none() || index == &usize::min_value(); let should_show_line_number = is_number_mode && should_show_line_number_merge_file; let fmtd_line_number: String = if should_show_line_number { - get_fmtd_line_number(&width, file_line.line_number, &separator) + get_fmtd_line_number(&number_width, file_line.line_number, &separator) } else { "".to_string() }; @@ -1263,13 +1308,7 @@ fn get_line_for_printing( let display_length = complete_line.len() + (tab_count * 7); // TODO Adjust the width according to -n option // TODO actual len of the string vs display len of string because of tabs - - let width: Option = match col_width { - Some(x) => Some(x), - None => page_width, - }; - - width + line_width .map(|i| { let min_width = (i - (columns - 1)) / columns; if display_length < min_width { diff --git a/tests/fixtures/pr/column_across_sep1.log.expected b/tests/fixtures/pr/column_across_sep1.log.expected new file mode 100644 index 000000000..f9dd454d7 --- /dev/null +++ b/tests/fixtures/pr/column_across_sep1.log.expected @@ -0,0 +1,198 @@ + + +{last_modified_time} column.log Page 3 + + + 337 337 divide 338 338 divide 339 339 + 340 340 divide 341 341 divide 342 342 + 343 343 divide 344 344 divide 345 345 + 346 346 divide 347 347 divide 348 348 + 349 349 divide 350 350 divide 351 351 + 352 352 divide 353 353 divide 354 354 + 355 355 divide 356 356 divide 357 357 + 358 358 divide 359 359 divide 360 360 + 361 361 divide 362 362 divide 363 363 + 364 364 divide 365 365 divide 366 366 + 367 367 divide 368 368 divide 369 369 + 370 370 divide 371 371 divide 372 372 + 373 373 divide 374 374 divide 375 375 + 376 376 divide 377 377 divide 378 378 + 379 379 divide 380 380 divide 381 381 + 382 382 divide 383 383 divide 384 384 + 385 385 divide 386 386 divide 387 387 + 388 388 divide 389 389 divide 390 390 + 391 391 divide 392 392 divide 393 393 + 394 394 divide 395 395 divide 396 396 + 397 397 divide 398 398 divide 399 399 + 400 400 divide 401 401 divide 402 402 + 403 403 divide 404 404 divide 405 405 + 406 406 divide 407 407 divide 408 408 + 409 409 divide 410 410 divide 411 411 + 412 412 divide 413 413 divide 414 414 + 415 415 divide 416 416 divide 417 417 + 418 418 divide 419 419 divide 420 420 + 421 421 divide 422 422 divide 423 423 + 424 424 divide 425 425 divide 426 426 + 427 427 divide 428 428 divide 429 429 + 430 430 divide 431 431 divide 432 432 + 433 433 divide 434 434 divide 435 435 + 436 436 divide 437 437 divide 438 438 + 439 439 divide 440 440 divide 441 441 + 442 442 divide 443 443 divide 444 444 + 445 445 divide 446 446 divide 447 447 + 448 448 divide 449 449 divide 450 450 + 451 451 divide 452 452 divide 453 453 + 454 454 divide 455 455 divide 456 456 + 457 457 divide 458 458 divide 459 459 + 460 460 divide 461 461 divide 462 462 + 463 463 divide 464 464 divide 465 465 + 466 466 divide 467 467 divide 468 468 + 469 469 divide 470 470 divide 471 471 + 472 472 divide 473 473 divide 474 474 + 475 475 divide 476 476 divide 477 477 + 478 478 divide 479 479 divide 480 480 + 481 481 divide 482 482 divide 483 483 + 484 484 divide 485 485 divide 486 486 + 487 487 divide 488 488 divide 489 489 + 490 490 divide 491 491 divide 492 492 + 493 493 divide 494 494 divide 495 495 + 496 496 divide 497 497 divide 498 498 + 499 499 divide 500 500 divide 501 501 + 502 502 divide 503 503 divide 504 504 + + + + + + + +{last_modified_time} column.log Page 4 + + + 505 505 divide 506 506 divide 507 507 + 508 508 divide 509 509 divide 510 510 + 511 511 divide 512 512 divide 513 513 + 514 514 divide 515 515 divide 516 516 + 517 517 divide 518 518 divide 519 519 + 520 520 divide 521 521 divide 522 522 + 523 523 divide 524 524 divide 525 525 + 526 526 divide 527 527 divide 528 528 + 529 529 divide 530 530 divide 531 531 + 532 532 divide 533 533 divide 534 534 + 535 535 divide 536 536 divide 537 537 + 538 538 divide 539 539 divide 540 540 + 541 541 divide 542 542 divide 543 543 + 544 544 divide 545 545 divide 546 546 + 547 547 divide 548 548 divide 549 549 + 550 550 divide 551 551 divide 552 552 + 553 553 divide 554 554 divide 555 555 + 556 556 divide 557 557 divide 558 558 + 559 559 divide 560 560 divide 561 561 + 562 562 divide 563 563 divide 564 564 + 565 565 divide 566 566 divide 567 567 + 568 568 divide 569 569 divide 570 570 + 571 571 divide 572 572 divide 573 573 + 574 574 divide 575 575 divide 576 576 + 577 577 divide 578 578 divide 579 579 + 580 580 divide 581 581 divide 582 582 + 583 583 divide 584 584 divide 585 585 + 586 586 divide 587 587 divide 588 588 + 589 589 divide 590 590 divide 591 591 + 592 592 divide 593 593 divide 594 594 + 595 595 divide 596 596 divide 597 597 + 598 598 divide 599 599 divide 600 600 + 601 601 divide 602 602 divide 603 603 + 604 604 divide 605 605 divide 606 606 + 607 607 divide 608 608 divide 609 609 + 610 610 divide 611 611 divide 612 612 + 613 613 divide 614 614 divide 615 615 + 616 616 divide 617 617 divide 618 618 + 619 619 divide 620 620 divide 621 621 + 622 622 divide 623 623 divide 624 624 + 625 625 divide 626 626 divide 627 627 + 628 628 divide 629 629 divide 630 630 + 631 631 divide 632 632 divide 633 633 + 634 634 divide 635 635 divide 636 636 + 637 637 divide 638 638 divide 639 639 + 640 640 divide 641 641 divide 642 642 + 643 643 divide 644 644 divide 645 645 + 646 646 divide 647 647 divide 648 648 + 649 649 divide 650 650 divide 651 651 + 652 652 divide 653 653 divide 654 654 + 655 655 divide 656 656 divide 657 657 + 658 658 divide 659 659 divide 660 660 + 661 661 divide 662 662 divide 663 663 + 664 664 divide 665 665 divide 666 666 + 667 667 divide 668 668 divide 669 669 + 670 670 divide 671 671 divide 672 672 + + + + + + + +{last_modified_time} column.log Page 5 + + + 673 673 divide 674 674 divide 675 675 + 676 676 divide 677 677 divide 678 678 + 679 679 divide 680 680 divide 681 681 + 682 682 divide 683 683 divide 684 684 + 685 685 divide 686 686 divide 687 687 + 688 688 divide 689 689 divide 690 690 + 691 691 divide 692 692 divide 693 693 + 694 694 divide 695 695 divide 696 696 + 697 697 divide 698 698 divide 699 699 + 700 700 divide 701 701 divide 702 702 + 703 703 divide 704 704 divide 705 705 + 706 706 divide 707 707 divide 708 708 + 709 709 divide 710 710 divide 711 711 + 712 712 divide 713 713 divide 714 714 + 715 715 divide 716 716 divide 717 717 + 718 718 divide 719 719 divide 720 720 + 721 721 divide 722 722 divide 723 723 + 724 724 divide 725 725 divide 726 726 + 727 727 divide 728 728 divide 729 729 + 730 730 divide 731 731 divide 732 732 + 733 733 divide 734 734 divide 735 735 + 736 736 divide 737 737 divide 738 738 + 739 739 divide 740 740 divide 741 741 + 742 742 divide 743 743 divide 744 744 + 745 745 divide 746 746 divide 747 747 + 748 748 divide 749 749 divide 750 750 + 751 751 divide 752 752 divide 753 753 + 754 754 divide 755 755 divide 756 756 + 757 757 divide 758 758 divide 759 759 + 760 760 divide 761 761 divide 762 762 + 763 763 divide 764 764 divide 765 765 + 766 766 divide 767 767 divide 768 768 + 769 769 divide 770 770 divide 771 771 + 772 772 divide 773 773 divide 774 774 + 775 775 divide 776 776 divide 777 777 + 778 778 divide 779 779 divide 780 780 + 781 781 divide 782 782 divide 783 783 + 784 784 divide 785 785 divide 786 786 + 787 787 divide 788 788 divide 789 789 + 790 790 divide 791 791 divide 792 792 + 793 793 divide 794 794 divide 795 795 + 796 796 divide 797 797 divide 798 798 + 799 799 divide 800 800 divide 801 801 + 802 802 divide 803 803 divide 804 804 + 805 805 divide 806 806 divide 807 807 + 808 808 divide 809 809 divide 810 810 + 811 811 divide 812 812 divide 813 813 + 814 814 divide 815 815 divide 816 816 + 817 817 divide 818 818 divide 819 819 + 820 820 divide 821 821 divide 822 822 + 823 823 divide 824 824 divide 825 825 + 826 826 divide 827 827 divide 828 828 + 829 829 divide 830 830 divide 831 831 + 832 832 divide 833 833 divide 834 834 + 835 835 divide 836 836 divide 837 837 + 838 838 divide 839 839 divide 840 840 + + + + + diff --git a/tests/fixtures/pr/joined.log.expected b/tests/fixtures/pr/joined.log.expected new file mode 100644 index 000000000..a9cee6e4f --- /dev/null +++ b/tests/fixtures/pr/joined.log.expected @@ -0,0 +1,132 @@ + + +{last_modified_time} Page 1 + + +##ntation processAirPortStateChanges]: pppConnectionState 0 +# Host DatabaseMon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +#Mon Dec 10 11:42:56.705 Info: 802.1X changed +# localhost is used to configure the loopback interfaceMon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +# when the system is booting. Do not change this entry.Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +##Mon Dec 10 11:42:56.854 Info: 802.1X changed +127.0.0.1 localhostMon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +127.0.0.1 Techopss-MacBook-Pro.localMon Dec 10 11:42:56.856 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +127.0.0.1 tilakprMon Dec 10 11:42:57.002 Info: 802.1X changed +255.255.255.255 broadcasthostMon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +::1 localhostMon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.152 Info: 802.1X changed +Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.302 Info: 802.1X changed +Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.449 Info: 802.1X changed +Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.600 Info: 802.1X changed +Mon Dec 10 11:42:57.601 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.602 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.749 Info: 802.1X changed +Mon Dec 10 11:42:57.750 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.751 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.896 Info: 802.1X changed +Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.045 Info: 802.1X changed +Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.193 Info: 802.1X changed +Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.342 Info: 802.1X changed +Mon Dec 10 11:42:58.343 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.344 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.491 Info: 802.1X changed +Mon Dec 10 11:42:58.493 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.494 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.640 Info: 802.1X changed +Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.805 Info: 802.1X changed +Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.958 Info: 802.1X changed +Mon Dec 10 11:42:58.959 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.960 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:59.155 Info: 802.1X changed +Mon Dec 10 11:42:59.157 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:59.159 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:59.352 Info: 802.1X changed + + + + + + + +{last_modified_time} Page 2 + + +Mon Dec 10 11:42:59.354 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:59.354 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:59.372 Driver Event: _bsd_80211_event_callback: APPLE80211_M_ROAM_END (en0) +Mon Dec 10 11:42:59.372 Info: Roaming ended on interface en0 +Mon Dec 10 11:42:59.372 Driver Event: _bsd_80211_event_callback: RSN_HANDSHAKE_DONE (en0) +Mon Dec 10 11:42:59.373 Info: -[CWXPCInterfaceContext setRoamInProgress:reason:]_block_invoke: roam status metric data: CWAWDMetricRoamStatus: status:0 security: 4 profile:5 origin:<34fcb9>(-69) target:<6cf37f>(-56) latency:6.083439s +Mon Dec 10 11:42:59.373 Info: -[CWAWDManager submitMetric:]: submitting metric id 0x90046 +Mon Dec 10 11:42:59.373 Info: RESUME AWDL for interface en0, reason=Roam token=2685 +Mon Dec 10 11:42:59.373 Info: PRIORITY LOCK REMOVED [client=airportd, type=4, interface=en0, priority=5] +Mon Dec 10 11:42:59.374 Info: -[CWXPCInterfaceContext __setAWDLOperatingMode:interface:error:]: attempting to set AWDL mode to 0 +Mon Dec 10 11:43:01.072 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Service/18E14EA7-4641-4104-B315-A9315814912A/DHCP' +Mon Dec 10 11:43:01.072 SC: _processDHCPChanges: State:/Network/Service/18E14EA7-4641-4104-B315-A9315814912A/DHCP +Mon Dec 10 11:43:01.072 SC: _processDHCPChanges: DHCP airport_changed = 1 +Mon Dec 10 11:43:01.073 Info: -[CWXPCSubsystem internal_submitIPConfigLatencyMetric:leaseDuration:]: IPConfig Latency metric data: CWAWDMetricIPConfigLatencyData: DHCP latency: 29010 msecs, duration: 480 mins, security: 4 +Mon Dec 10 11:43:01.073 Info: -[CWAWDManager submitMetric:]: submitting metric id 0x90007 +Mon Dec 10 11:43:01.073 SC: _setDHCPMessage: dhcpInfoKey "State:/Network/Interface/en0/AirPort/DHCP Message" = (null) +Mon Dec 10 11:43:10.369 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 11:43:10.369 Info: _bsd_80211_event_callback: link quality: RSSI=-57 dBm TxRate=162 Mbps +Mon Dec 10 11:43:10.369 Info: link quality changed +Mon Dec 10 11:43:23.376 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 11:43:23.377 Info: _bsd_80211_event_callback: link quality: RSSI=-58 dBm TxRate=243 Mbps +Mon Dec 10 11:43:23.377 Info: link quality changed +Mon Dec 10 11:43:28.380 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 11:43:28.380 Info: _bsd_80211_event_callback: link quality: RSSI=-58 dBm TxRate=216 Mbps +Mon Dec 10 11:43:28.380 Info: link quality changed +Mon Dec 10 11:43:31.744 AutoJoin: BACKGROUND SCAN request on interface en0 with SSID list (null) +Mon Dec 10 11:43:31.747 Scan: Cache-assisted scan request on channel 1 does not require a live scan +Mon Dec 10 11:43:31.748 Scan: Cache-assisted scan request on channel 2 does not require a live scan +Mon Dec 10 11:43:31.748 Scan: Cache-assisted scan request on channel 3 does not require a live scan +Mon Dec 10 11:43:31.748 Scan: Cache-assisted scan request does not require a live scan +Mon Dec 10 11:43:31.748 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 11:43:31.748 [channelNumber=1(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 11:43:31.748 [channelNumber=2(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 11:43:31.748 [channelNumber=3(2GHz), channelWidth={20MHz}, active] +Mon Dec 10 11:43:31.748 )} took 0.0025 seconds, returned 10 results +Mon Dec 10 11:43:31.748 Scan: Cache-assisted scan request on channel 4 does not require a live scan +Mon Dec 10 11:43:31.748 Scan: Cache-assisted scan request on channel 5 does not require a live scan +Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request on channel 6 does not require a live scan +Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request does not require a live scan +Mon Dec 10 11:43:31.749 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 11:43:31.749 [channelNumber=4(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 11:43:31.749 [channelNumber=5(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 11:43:31.749 [channelNumber=6(2GHz), channelWidth={20MHz}, active] +Mon Dec 10 11:43:31.749 )} took 0.0008 seconds, returned 7 results +Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request on channel 7 does not require a live scan +Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request on channel 8 does not require a live scan +Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request on channel 9 does not require a live scan +Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request does not require a live scan +Mon Dec 10 11:43:31.749 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 11:43:31.749 [channelNumber=7(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 11:43:31.749 [channelNumber=8(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 11:43:31.749 [channelNumber=9(2GHz), channelWidth={20MHz}, active] +Mon Dec 10 11:43:31.749 )} took 0.0002 seconds, returned 1 results +Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request on channel 10 does not require a live scan +Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request on channel 11 does not require a live scan +Mon Dec 10 11:43:31.750 Scan: Cache-assisted scan request on channel 12 does not require a live scan + + + + + diff --git a/tests/test_pr.rs b/tests/test_pr.rs index 1026b77a9..b4ff61ed7 100644 --- a/tests/test_pr.rs +++ b/tests/test_pr.rs @@ -382,6 +382,7 @@ fn test_with_column_across_option() { fn test_with_column_across_option_and_column_separator() { let test_file_path = "column.log"; let expected_test_file_path = "column_across_sep.log.expected"; + let expected_test_file_path1 = "column_across_sep1.log.expected"; let mut scenario = new_ucmd!(); let value = file_last_modified_time(&scenario, test_file_path); scenario @@ -398,6 +399,21 @@ fn test_with_column_across_option_and_column_separator() { expected_test_file_path, vec![(&"{last_modified_time}".to_string(), &value)], ); + + new_ucmd!() + .args(&[ + "--pages=3:5", + "--column=3", + "-Sdivide", + "-a", + "-n", + test_file_path, + ]) + .succeeds() + .stdout_is_templated_fixture( + expected_test_file_path1, + vec![(&"{last_modified_time}".to_string(), &value)], + ); } #[test] @@ -526,3 +542,18 @@ fn test_with_pr_core_utils_tests() { ); } } + +#[test] +fn test_with_join_lines_option() { + let test_file_1 = "hosts.log"; + let test_file_2 = "test.log"; + let expected_file_path = "joined.log.expected"; + let mut scenario = new_ucmd!(); + scenario + .args(&["+1:2", "-J", "-m", test_file_1, test_file_2]) + .run() + .stdout_is_templated_fixture( + expected_file_path, + vec![(&"{last_modified_time}".to_string(), &now_time())], + ); +}