diff --git a/cmd/cli/item.go b/cmd/cli/item.go index 98a919f..54e9fa3 100644 --- a/cmd/cli/item.go +++ b/cmd/cli/item.go @@ -202,6 +202,9 @@ func newItemFromRecordForQuery(record records.EnrichedRecord, query query, debug flags += " E" + strconv.Itoa(record.ExitCode) flagsWithColor += " " + highlightWarn("E"+strconv.Itoa(record.ExitCode)) } + // NOTE: you can debug arbitrary metadata like this + // flags += " <" + record.GitOriginRemote + ">" + // flagsWithColor += " <" + record.GitOriginRemote + ">" // DISPLAY > cmdline diff --git a/pkg/records/records.go b/pkg/records/records.go index b2ef7e6..0d0be91 100644 --- a/pkg/records/records.go +++ b/pkg/records/records.go @@ -169,26 +169,26 @@ func (r EnrichedRecord) ToString() (string, error) { // Enriched - returnd enriched record func Enriched(r Record) EnrichedRecord { record := EnrichedRecord{Record: r} + // normlize git remote + record.GitOriginRemote = NormalizeGitRemote(record.GitOriginRemote) + record.GitOriginRemoteAfter = NormalizeGitRemote(record.GitOriginRemoteAfter) // Get command/first word from commandline var err error - record.Command, record.FirstWord, err = GetCommandAndFirstWord(r.CmdLine) + err = r.Validate() if err != nil { - record.Errors = append(record.Errors, "GetCommandAndFirstWord error:"+err.Error()) + record.Errors = append(record.Errors, "Validate error:"+err.Error()) // rec, _ := record.ToString() // log.Println("Invalid command:", rec) record.Invalid = true - return record } - err = r.Validate() + record.Command, record.FirstWord, err = GetCommandAndFirstWord(r.CmdLine) if err != nil { - record.Errors = append(record.Errors, "Validate error:"+err.Error()) + record.Errors = append(record.Errors, "GetCommandAndFirstWord error:"+err.Error()) // rec, _ := record.ToString() // log.Println("Invalid command:", rec) - record.Invalid = true + record.Invalid = true // should this be really invalid ? } - record.GitOriginRemote = NormalizeGitRemote(record.GitOriginRemote) return record - // TODO: Detect and mark simple commands r.Simple } // Merge two records (part1 - collect + part2 - postcollect)