| skipped 1306 lines |
1307 | 1307 | | validateJumpLabels := false |
1308 | 1308 | | validatePointer := false |
1309 | 1309 | | validateMarker := false |
1310 | | - | validateEllipsis := false |
1311 | 1310 | | for i := 0; i < len(allArgs); i++ { |
1312 | 1311 | | arg := allArgs[i] |
1313 | 1312 | | switch arg { |
| skipped 181 lines |
1495 | 1494 | | opts.HeaderFirst = false |
1496 | 1495 | | case "--ellipsis": |
1497 | 1496 | | opts.Ellipsis = nextString(allArgs, &i, "ellipsis string required") |
1498 | | - | validateEllipsis = true |
1499 | 1497 | | case "--preview": |
1500 | 1498 | | opts.Preview.command = nextString(allArgs, &i, "preview command required") |
1501 | 1499 | | case "--no-preview": |
| skipped 93 lines |
1595 | 1593 | | opts.HeaderLines = atoi(value) |
1596 | 1594 | | } else if match, value := optString(arg, "--ellipsis="); match { |
1597 | 1595 | | opts.Ellipsis = value |
1598 | | - | validateEllipsis = true |
1599 | 1596 | | } else if match, value := optString(arg, "--preview="); match { |
1600 | 1597 | | opts.Preview.command = value |
1601 | 1598 | | } else if match, value := optString(arg, "--preview-window="); match { |
| skipped 56 lines |
1658 | 1655 | | errorExit(err.Error()) |
1659 | 1656 | | } |
1660 | 1657 | | } |
1661 | | - | |
1662 | | - | if validateEllipsis { |
1663 | | - | for _, r := range opts.Ellipsis { |
1664 | | - | if !unicode.IsGraphic(r) { |
1665 | | - | errorExit("invalid character in ellipsis") |
1666 | | - | } |
1667 | | - | } |
1668 | | - | } |
1669 | 1658 | | } |
1670 | 1659 | | |
1671 | 1660 | | func validateSign(sign string, signOptName string) error { |
1672 | 1661 | | if sign == "" { |
1673 | 1662 | | return fmt.Errorf("%v cannot be empty", signOptName) |
1674 | | - | } |
1675 | | - | for _, r := range sign { |
1676 | | - | if !unicode.IsGraphic(r) { |
1677 | | - | return fmt.Errorf("invalid character in %v", signOptName) |
1678 | | - | } |
1679 | 1663 | | } |
1680 | 1664 | | if runewidth.StringWidth(sign) > 2 { |
1681 | 1665 | | return fmt.Errorf("%v display width should be up to 2", signOptName) |
| skipped 96 lines |