mirror of
https://github.com/chenasraf/cospend-cli.git
synced 2026-05-18 01:39:03 +00:00
fix: trim newlines/spaces in bill what field
This commit is contained in:
@@ -354,8 +354,13 @@ func printBillsTable(cmd *cobra.Command, project *api.Project, bills []api.BillR
|
||||
methodName = "-"
|
||||
}
|
||||
|
||||
// Truncate name if too long
|
||||
name := bill.What
|
||||
// Sanitize and truncate name
|
||||
name := strings.Map(func(r rune) rune {
|
||||
if r == '\n' || r == '\r' || r == '\t' {
|
||||
return ' '
|
||||
}
|
||||
return r
|
||||
}, strings.TrimSpace(bill.What))
|
||||
if len(name) > 30 {
|
||||
name = name[:27] + "..."
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user