Skip to content

Commit

Permalink
refactor: ♻️ optimize if condition
Browse files Browse the repository at this point in the history
remove an impossible/unused condition
  • Loading branch information
Equationzhao committed Jan 31, 2024
1 parent 5583747 commit 3e754d6
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions internal/cli/g.go
Original file line number Diff line number Diff line change
Expand Up @@ -921,14 +921,11 @@ var logic = func(context *cli.Context) error {
for _, it := range infos {
for _, part := range allPart {
content, _ := it.Get(part)
l := 0
if part != contents.NameName {
l = display.WidthNoHyperLinkLen(content.String())
} else {
l = display.WidthLen(content.String())
}
if l > longestEachPart[part] {
longestEachPart[part] = l
l := display.WidthNoHyperLinkLen(content.String())
if l > longestEachPart[part] {
longestEachPart[part] = l
}
}
}
}
Expand All @@ -938,11 +935,7 @@ var logic = func(context *cli.Context) error {
for _, part := range allPart {
if part != contents.NameName {
content, _ := it.Get(part)
if part != contents.NameName {
l = display.WidthNoHyperLinkLen(content.String())
} else {
l = display.WidthLen(content.String())
}
l := display.WidthNoHyperLinkLen(content.String())
if l < longestEachPart[part] {
expand := content.SetPrefix
if align.IsLeft(part) {
Expand Down

0 comments on commit 3e754d6

Please sign in to comment.