1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

pr: add -J and -S option

pr: add -J option

pr: add -S option
This commit is contained in:
tilakpatidar 2019-01-06 16:12:23 +05:30 committed by Max Semenik
parent a4b723233a
commit 40e7f3d900
4 changed files with 433 additions and 33 deletions

View file

@ -57,9 +57,11 @@ static COLUMN_WIDTH_OPTION: &str = "w";
static PAGE_WIDTH_OPTION: &str = "W"; static PAGE_WIDTH_OPTION: &str = "W";
static ACROSS_OPTION: &str = "a"; static ACROSS_OPTION: &str = "a";
static COLUMN_OPTION: &str = "column"; 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 MERGE_FILES_PRINT: &str = "m";
static OFFSET_SPACES_OPTION: &str = "o"; static OFFSET_SPACES_OPTION: &str = "o";
static JOIN_LINES_OPTION: &str = "J";
static FILE_STDIN: &str = "-"; static FILE_STDIN: &str = "-";
static READ_BUFFER_SIZE: usize = 1024 * 64; static READ_BUFFER_SIZE: usize = 1024 * 64;
static DEFAULT_COLUMN_WIDTH: usize = 72; static DEFAULT_COLUMN_WIDTH: usize = 72;
@ -87,6 +89,7 @@ struct OutputOptions {
offset_spaces: usize, offset_spaces: usize,
form_feed_used: bool, form_feed_used: bool,
page_width: Option<usize>, page_width: Option<usize>,
join_lines: bool,
} }
struct FileLine { struct FileLine {
@ -332,8 +335,8 @@ pub fn uumain(args: Vec<String>) -> i32 {
); );
opts.opt( 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 <space>s "Separate text columns by the single character char instead of by the appropriate number of <space>s
(default for char is the <tab> character).", (default for char is the <tab> character).",
"char", "char",
@ -341,6 +344,17 @@ pub fn uumain(args: Vec<String>) -> i32 {
Occur::Optional, Occur::Optional,
); );
opts.opt(
COLUMN_STRING_SEPARATOR_OPTION,
"sep-string",
"separate columns by STRING,
without -S: Default separator <TAB> with -J and <space>
otherwise (same as -S\" \"), no effect on column options",
"string",
HasArg::Yes,
Occur::Optional,
);
opts.opt( opts.opt(
MERGE_FILES_PRINT, MERGE_FILES_PRINT,
"merge", "merge",
@ -362,6 +376,16 @@ pub fn uumain(args: Vec<String>) -> i32 {
Occur::Optional, 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("", "help", "display this help and exit");
opts.optflag("V", "version", "output version information and exit"); opts.optflag("V", "version", "output version information and exit");
@ -648,10 +672,10 @@ fn build_options(
x[0].to_string() x[0].to_string()
}) })
.map(invalid_pages_map) .map(invalid_pages_map)
{ {
Some(res) => res?, Some(res) => res?,
_ => start_page_in_plus_option, _ => start_page_in_plus_option,
}; };
let end_page: Option<usize> = match matches let end_page: Option<usize> = match matches
.opt_str(PAGE_RANGE_OPTION) .opt_str(PAGE_RANGE_OPTION)
@ -661,10 +685,10 @@ fn build_options(
x[1].to_string() x[1].to_string()
}) })
.map(invalid_pages_map) .map(invalid_pages_map)
{ {
Some(res) => Some(res?), Some(res) => Some(res?),
_ => end_page_in_plus_option, _ => end_page_in_plus_option,
}; };
if end_page.is_some() && start_page > end_page.unwrap() { if end_page.is_some() && start_page > end_page.unwrap() {
return Err(PrError::EncounteredErrors(format!( return Err(PrError::EncounteredErrors(format!(
@ -699,12 +723,15 @@ fn build_options(
let across_mode: bool = matches.opt_present(ACROSS_OPTION); let across_mode: bool = matches.opt_present(ACROSS_OPTION);
let column_separator: String = matches let column_separator: String = match matches.opt_str(COLUMN_STRING_SEPARATOR_OPTION)
.opt_str(COLUMN_SEPARATOR_OPTION) {
Some(x) => Some(x),
None => matches.opt_str(COLUMN_CHAR_SEPARATOR_OPTION),
}
.unwrap_or(DEFAULT_COLUMN_SEPARATOR.to_string()); .unwrap_or(DEFAULT_COLUMN_SEPARATOR.to_string());
let default_column_width = if matches.opt_present(COLUMN_WIDTH_OPTION) 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 DEFAULT_COLUMN_WIDTH_WITH_S_OPTION
} else { } else {
@ -713,9 +740,14 @@ fn build_options(
let column_width: usize = let column_width: usize =
parse_usize(matches, COLUMN_WIDTH_OPTION).unwrap_or(Ok(default_column_width))?; parse_usize(matches, COLUMN_WIDTH_OPTION).unwrap_or(Ok(default_column_width))?;
let page_width: Option<usize> = match parse_usize(matches, PAGE_WIDTH_OPTION) {
Some(res) => Some(res?), let page_width: Option<usize> = if matches.opt_present(JOIN_LINES_OPTION) {
None => None, 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(); 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 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 { Ok(OutputOptions {
number: numbering_options, number: numbering_options,
header, header,
@ -766,6 +800,7 @@ fn build_options(
offset_spaces, offset_spaces,
form_feed_used, form_feed_used,
page_width, page_width,
join_lines,
}) })
} }
@ -1133,7 +1168,7 @@ fn write_columns(
options.content_lines_per_page 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 let number_separator: String = options
.number .number
.as_ref() .as_ref()
@ -1168,6 +1203,18 @@ fn write_columns(
let page_width: Option<usize> = options.page_width; let page_width: Option<usize> = options.page_width;
let line_width: Option<usize> = 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 let across_mode = options
.column_mode_options .column_mode_options
.as_ref() .as_ref()
@ -1208,18 +1255,17 @@ fn write_columns(
spaces, spaces,
get_line_for_printing( get_line_for_printing(
file_line, file_line,
&width, &number_width,
&number_separator, &number_separator,
columns, columns,
col_width,
is_number_mode, is_number_mode,
&options.merge_files_print, &options.merge_files_print,
&i, &i,
page_width line_width,
) )
); );
out.write(trimmed_line.as_bytes())?; out.write(trimmed_line.as_bytes())?;
if (i + 1) != indexes { if (i + 1) != indexes && !options.join_lines {
out.write(col_sep.as_bytes())?; out.write(col_sep.as_bytes())?;
} }
lines_printed += 1; lines_printed += 1;
@ -1235,20 +1281,19 @@ fn write_columns(
fn get_line_for_printing( fn get_line_for_printing(
file_line: &FileLine, file_line: &FileLine,
width: &usize, number_width: &usize,
separator: &String, separator: &String,
columns: usize, columns: usize,
col_width: Option<usize>,
is_number_mode: bool, is_number_mode: bool,
merge_files_print: &Option<usize>, merge_files_print: &Option<usize>,
index: &usize, index: &usize,
page_width: Option<usize>, line_width: Option<usize>,
) -> String { ) -> String {
let should_show_line_number_merge_file = let should_show_line_number_merge_file =
merge_files_print.is_none() || index == &usize::min_value(); merge_files_print.is_none() || index == &usize::min_value();
let should_show_line_number = is_number_mode && should_show_line_number_merge_file; let should_show_line_number = is_number_mode && should_show_line_number_merge_file;
let fmtd_line_number: String = if should_show_line_number { 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 { } else {
"".to_string() "".to_string()
}; };
@ -1263,13 +1308,7 @@ fn get_line_for_printing(
let display_length = complete_line.len() + (tab_count * 7); let display_length = complete_line.len() + (tab_count * 7);
// TODO Adjust the width according to -n option // TODO Adjust the width according to -n option
// TODO actual len of the string vs display len of string because of tabs // TODO actual len of the string vs display len of string because of tabs
line_width
let width: Option<usize> = match col_width {
Some(x) => Some(x),
None => page_width,
};
width
.map(|i| { .map(|i| {
let min_width = (i - (columns - 1)) / columns; let min_width = (i - (columns - 1)) / columns;
if display_length < min_width { if display_length < min_width {

View file

@ -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

132
tests/fixtures/pr/joined.log.expected vendored Normal file
View file

@ -0,0 +1,132 @@
{last_modified_time} Page 1
##ntation processAirPortStateChanges]: pppConnectionState 0
# Host DatabaseMon Dec 10 11:42:56.558 Info: <Wi-Fi Menu Extra[335]> -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars
#Mon Dec 10 11:42:56.705 Info: <Wi-Fi Menu Extra[335]> 802.1X changed
# localhost is used to configure the loopback interfaceMon Dec 10 11:42:56.706 Info: <Wi-Fi Menu Extra[335]> -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0
# when the system is booting. Do not change this entry.Mon Dec 10 11:42:56.706 Info: <Wi-Fi Menu Extra[335]> -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars
##Mon Dec 10 11:42:56.854 Info: <Wi-Fi Menu Extra[335]> 802.1X changed
127.0.0.1 localhostMon Dec 10 11:42:56.855 Info: <Wi-Fi Menu Extra[335]> -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0
127.0.0.1 Techopss-MacBook-Pro.localMon Dec 10 11:42:56.856 Info: <Wi-Fi Menu Extra[335]> -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars
127.0.0.1 tilakprMon Dec 10 11:42:57.002 Info: <Wi-Fi Menu Extra[335]> 802.1X changed
255.255.255.255 broadcasthostMon Dec 10 11:42:57.003 Info: <Wi-Fi Menu Extra[335]> -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0
::1 localhostMon Dec 10 11:42:57.003 Info: <Wi-Fi Menu Extra[335]> -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars
Mon Dec 10 11:42:57.152 Info: <Wi-Fi Menu Extra[335]> 802.1X changed
Mon Dec 10 11:42:57.154 Info: <Wi-Fi Menu Extra[335]> -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0
Mon Dec 10 11:42:57.154 Info: <Wi-Fi Menu Extra[335]> -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars
Mon Dec 10 11:42:57.302 Info: <Wi-Fi Menu Extra[335]> 802.1X changed
Mon Dec 10 11:42:57.304 Info: <Wi-Fi Menu Extra[335]> -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0
Mon Dec 10 11:42:57.304 Info: <Wi-Fi Menu Extra[335]> -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars
Mon Dec 10 11:42:57.449 Info: <Wi-Fi Menu Extra[335]> 802.1X changed
Mon Dec 10 11:42:57.451 Info: <Wi-Fi Menu Extra[335]> -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0
Mon Dec 10 11:42:57.451 Info: <Wi-Fi Menu Extra[335]> -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars
Mon Dec 10 11:42:57.600 Info: <Wi-Fi Menu Extra[335]> 802.1X changed
Mon Dec 10 11:42:57.601 Info: <Wi-Fi Menu Extra[335]> -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0
Mon Dec 10 11:42:57.602 Info: <Wi-Fi Menu Extra[335]> -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars
Mon Dec 10 11:42:57.624 Info: <Wi-Fi Menu Extra[335]> -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0
Mon Dec 10 11:42:57.624 Info: <Wi-Fi Menu Extra[335]> -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars
Mon Dec 10 11:42:57.749 Info: <Wi-Fi Menu Extra[335]> 802.1X changed
Mon Dec 10 11:42:57.750 Info: <Wi-Fi Menu Extra[335]> -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0
Mon Dec 10 11:42:57.751 Info: <Wi-Fi Menu Extra[335]> -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars
Mon Dec 10 11:42:57.896 Info: <Wi-Fi Menu Extra[335]> 802.1X changed
Mon Dec 10 11:42:57.897 Info: <Wi-Fi Menu Extra[335]> -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0
Mon Dec 10 11:42:57.897 Info: <Wi-Fi Menu Extra[335]> -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars
Mon Dec 10 11:42:58.045 Info: <Wi-Fi Menu Extra[335]> 802.1X changed
Mon Dec 10 11:42:58.047 Info: <Wi-Fi Menu Extra[335]> -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0
Mon Dec 10 11:42:58.047 Info: <Wi-Fi Menu Extra[335]> -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars
Mon Dec 10 11:42:58.193 Info: <Wi-Fi Menu Extra[335]> 802.1X changed
Mon Dec 10 11:42:58.195 Info: <Wi-Fi Menu Extra[335]> -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0
Mon Dec 10 11:42:58.195 Info: <Wi-Fi Menu Extra[335]> -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars
Mon Dec 10 11:42:58.342 Info: <Wi-Fi Menu Extra[335]> 802.1X changed
Mon Dec 10 11:42:58.343 Info: <Wi-Fi Menu Extra[335]> -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0
Mon Dec 10 11:42:58.344 Info: <Wi-Fi Menu Extra[335]> -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars
Mon Dec 10 11:42:58.491 Info: <Wi-Fi Menu Extra[335]> 802.1X changed
Mon Dec 10 11:42:58.493 Info: <Wi-Fi Menu Extra[335]> -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0
Mon Dec 10 11:42:58.494 Info: <Wi-Fi Menu Extra[335]> -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars
Mon Dec 10 11:42:58.640 Info: <Wi-Fi Menu Extra[335]> 802.1X changed
Mon Dec 10 11:42:58.642 Info: <Wi-Fi Menu Extra[335]> -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0
Mon Dec 10 11:42:58.642 Info: <Wi-Fi Menu Extra[335]> -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars
Mon Dec 10 11:42:58.805 Info: <Wi-Fi Menu Extra[335]> 802.1X changed
Mon Dec 10 11:42:58.806 Info: <Wi-Fi Menu Extra[335]> -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0
Mon Dec 10 11:42:58.806 Info: <Wi-Fi Menu Extra[335]> -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars
Mon Dec 10 11:42:58.958 Info: <Wi-Fi Menu Extra[335]> 802.1X changed
Mon Dec 10 11:42:58.959 Info: <Wi-Fi Menu Extra[335]> -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0
Mon Dec 10 11:42:58.960 Info: <Wi-Fi Menu Extra[335]> -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars
Mon Dec 10 11:42:59.155 Info: <Wi-Fi Menu Extra[335]> 802.1X changed
Mon Dec 10 11:42:59.157 Info: <Wi-Fi Menu Extra[335]> -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0
Mon Dec 10 11:42:59.159 Info: <Wi-Fi Menu Extra[335]> -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars
Mon Dec 10 11:42:59.352 Info: <Wi-Fi Menu Extra[335]> 802.1X changed
{last_modified_time} Page 2
Mon Dec 10 11:42:59.354 Info: <Wi-Fi Menu Extra[335]> -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0
Mon Dec 10 11:42:59.354 Info: <Wi-Fi Menu Extra[335]> -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars
Mon Dec 10 11:42:59.372 Driver Event: <airportd[160]> _bsd_80211_event_callback: APPLE80211_M_ROAM_END (en0)
Mon Dec 10 11:42:59.372 Info: <airportd[160]> Roaming ended on interface en0
Mon Dec 10 11:42:59.372 Driver Event: <airportd[160]> _bsd_80211_event_callback: RSN_HANDSHAKE_DONE (en0)
Mon Dec 10 11:42:59.373 Info: <airportd[160]> -[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: <airportd[160]> -[CWAWDManager submitMetric:]: submitting metric id 0x90046
Mon Dec 10 11:42:59.373 Info: <airportd[160]> RESUME AWDL for interface en0, reason=Roam token=2685
Mon Dec 10 11:42:59.373 Info: <airportd[160]> PRIORITY LOCK REMOVED [client=airportd, type=4, interface=en0, priority=5]
Mon Dec 10 11:42:59.374 Info: <airportd[160]> -[CWXPCInterfaceContext __setAWDLOperatingMode:interface:error:]: attempting to set AWDL mode to 0
Mon Dec 10 11:43:01.072 SC: <airportd[160]> airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Service/18E14EA7-4641-4104-B315-A9315814912A/DHCP'
Mon Dec 10 11:43:01.072 SC: <airportd[160]> _processDHCPChanges: State:/Network/Service/18E14EA7-4641-4104-B315-A9315814912A/DHCP
Mon Dec 10 11:43:01.072 SC: <airportd[160]> _processDHCPChanges: DHCP airport_changed = 1
Mon Dec 10 11:43:01.073 Info: <airportd[160]> -[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: <airportd[160]> -[CWAWDManager submitMetric:]: submitting metric id 0x90007
Mon Dec 10 11:43:01.073 SC: <airportd[160]> _setDHCPMessage: dhcpInfoKey "State:/Network/Interface/en0/AirPort/DHCP Message" = (null)
Mon Dec 10 11:43:10.369 Driver Event: <airportd[160]> _bsd_80211_event_callback: LINK_QUALITY (en0)
Mon Dec 10 11:43:10.369 Info: <airportd[160]> _bsd_80211_event_callback: <en0> link quality: RSSI=-57 dBm TxRate=162 Mbps
Mon Dec 10 11:43:10.369 Info: <Wi-Fi Menu Extra[335]> link quality changed
Mon Dec 10 11:43:23.376 Driver Event: <airportd[160]> _bsd_80211_event_callback: LINK_QUALITY (en0)
Mon Dec 10 11:43:23.377 Info: <airportd[160]> _bsd_80211_event_callback: <en0> link quality: RSSI=-58 dBm TxRate=243 Mbps
Mon Dec 10 11:43:23.377 Info: <Wi-Fi Menu Extra[335]> link quality changed
Mon Dec 10 11:43:28.380 Driver Event: <airportd[160]> _bsd_80211_event_callback: LINK_QUALITY (en0)
Mon Dec 10 11:43:28.380 Info: <airportd[160]> _bsd_80211_event_callback: <en0> link quality: RSSI=-58 dBm TxRate=216 Mbps
Mon Dec 10 11:43:28.380 Info: <Wi-Fi Menu Extra[335]> link quality changed
Mon Dec 10 11:43:31.744 AutoJoin: <airportd[160]> BACKGROUND SCAN request on interface en0 with SSID list (null)
Mon Dec 10 11:43:31.747 Scan: <airportd[160]> Cache-assisted scan request on channel 1 does not require a live scan
Mon Dec 10 11:43:31.748 Scan: <airportd[160]> Cache-assisted scan request on channel 2 does not require a live scan
Mon Dec 10 11:43:31.748 Scan: <airportd[160]> Cache-assisted scan request on channel 3 does not require a live scan
Mon Dec 10 11:43:31.748 Scan: <airportd[160]> Cache-assisted scan request does not require a live scan
Mon Dec 10 11:43:31.748 AutoJoin: <airportd[160]> Successful cache-assisted background scan request with channels {(
Mon Dec 10 11:43:31.748 <CWChannel: 0x7fc3fcd22180> [channelNumber=1(2GHz), channelWidth={20MHz}, active],
Mon Dec 10 11:43:31.748 <CWChannel: 0x7fc3fcd284a0> [channelNumber=2(2GHz), channelWidth={20MHz}, active],
Mon Dec 10 11:43:31.748 <CWChannel: 0x7fc3fcd13910> [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: <airportd[160]> Cache-assisted scan request on channel 4 does not require a live scan
Mon Dec 10 11:43:31.748 Scan: <airportd[160]> Cache-assisted scan request on channel 5 does not require a live scan
Mon Dec 10 11:43:31.749 Scan: <airportd[160]> Cache-assisted scan request on channel 6 does not require a live scan
Mon Dec 10 11:43:31.749 Scan: <airportd[160]> Cache-assisted scan request does not require a live scan
Mon Dec 10 11:43:31.749 AutoJoin: <airportd[160]> Successful cache-assisted background scan request with channels {(
Mon Dec 10 11:43:31.749 <CWChannel: 0x7fc3fcd0e7e0> [channelNumber=4(2GHz), channelWidth={20MHz}, active],
Mon Dec 10 11:43:31.749 <CWChannel: 0x7fc3fcd18a40> [channelNumber=5(2GHz), channelWidth={20MHz}, active],
Mon Dec 10 11:43:31.749 <CWChannel: 0x7fc3fcd0ae10> [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: <airportd[160]> Cache-assisted scan request on channel 7 does not require a live scan
Mon Dec 10 11:43:31.749 Scan: <airportd[160]> Cache-assisted scan request on channel 8 does not require a live scan
Mon Dec 10 11:43:31.749 Scan: <airportd[160]> Cache-assisted scan request on channel 9 does not require a live scan
Mon Dec 10 11:43:31.749 Scan: <airportd[160]> Cache-assisted scan request does not require a live scan
Mon Dec 10 11:43:31.749 AutoJoin: <airportd[160]> Successful cache-assisted background scan request with channels {(
Mon Dec 10 11:43:31.749 <CWChannel: 0x7fc3fcd57a80> [channelNumber=7(2GHz), channelWidth={20MHz}, active],
Mon Dec 10 11:43:31.749 <CWChannel: 0x7fc3fcd32290> [channelNumber=8(2GHz), channelWidth={20MHz}, active],
Mon Dec 10 11:43:31.749 <CWChannel: 0x7fc3fcd77ab0> [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: <airportd[160]> Cache-assisted scan request on channel 10 does not require a live scan
Mon Dec 10 11:43:31.749 Scan: <airportd[160]> Cache-assisted scan request on channel 11 does not require a live scan
Mon Dec 10 11:43:31.750 Scan: <airportd[160]> Cache-assisted scan request on channel 12 does not require a live scan

View file

@ -382,6 +382,7 @@ fn test_with_column_across_option() {
fn test_with_column_across_option_and_column_separator() { fn test_with_column_across_option_and_column_separator() {
let test_file_path = "column.log"; let test_file_path = "column.log";
let expected_test_file_path = "column_across_sep.log.expected"; 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 mut scenario = new_ucmd!();
let value = file_last_modified_time(&scenario, test_file_path); let value = file_last_modified_time(&scenario, test_file_path);
scenario scenario
@ -398,6 +399,21 @@ fn test_with_column_across_option_and_column_separator() {
expected_test_file_path, expected_test_file_path,
vec![(&"{last_modified_time}".to_string(), &value)], 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] #[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())],
);
}