Skip to content

Cannot handle aligned multi-space-delimited files #212

@Jolanrensen

Description

@Jolanrensen

Description
Let's say we have a multi-space-delimited file like:

NAME                     STATUS   AGE      LABELS
argo-events              Active   2y77d    app.kubernetes.io/instance=argo-events,kubernetes.io/metadata.name=argo-events
argo-workflows           Active   2y77d    app.kubernetes.io/instance=argo-workflows,kubernetes.io/metadata.name=argo-workflows
argocd                   Active   5y18d    kubernetes.io/metadata.name=argocd
beta                     Active   4y235d   kubernetes.io/metadata.name=beta

which is a common thing to see in logs etc., I cannot seem to parse it correctly.
The delimiter can only be a char, which I suppose should be ' ' in this case and then we could trim the rest with ignoreSurroundingSpaces = true

Steps to reproduce

Parse the string above with delimiter ' ', ignoreSurroundingSpaces = true.

Expected results

I'd expect there to be a way to ignore repetition of the delimiter char.

Actual results

After parsing, we get something like:

⌌---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------⌍
|  |           NAME| untitled| 1| 2| 3| 4| 5| 6| 7| 8| 9|     10| 11| 12|     13| 14| 15|    16|                                       17|     18|   19|                                   STATUS|    20|   21|    AGE|   22|                                 23|                               24|   25|   26| LABELS|
|--|---------------|---------|--|--|--|--|--|--|--|--|--|-------|---|---|-------|---|---|------|-----------------------------------------|-------|-----|-----------------------------------------|------|-----|-------|-----|-----------------------------------|---------------------------------|-----|-----|-------|
| 0|    argo-events|         |  |  |  |  |  |  |  |  |  |       |   |   | Active|   |   | 2y77d|                                         |       |     | app.kubernetes.io/instance=argo-event...|  null| null|   null| null|                               null|                             null| null| null|   null|
| 1| argo-workflows|         |  |  |  |  |  |  |  |  |  | Active|   |   |  2y77d|   |   |      | app.kubernetes.io/instance=argo-workf...|   null| null|                                     null|  null| null|   null| null|                               null|                             null| null| null|   null|
| 2|         argocd|         |  |  |  |  |  |  |  |  |  |       |   |   |       |   |   |      |                                         | Active|     |                                         | 5y18d|     |       |     | kubernetes.io/metadata.name=argocd|                             null| null| null|   null|
| 3|           beta|         |  |  |  |  |  |  |  |  |  |       |   |   |       |   |   |      |                                         |       |     |                                   Active|      |     | 4y235d|     |                                   | kubernetes.io/metadata.name=beta| null| null|   null|
⌎---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------⌏

Edit:

Additionally common; A single space inside a column, while multiple spaces indicates a delimiter, like:

NAME                     STATUS       AGE      LABELS
argo-events              Not Active   2y77d    app.kubernetes.io/instance=argo-events,kubernetes.io/metadata.name=argo-events
argo-workflows           Active       2y77d    app.kubernetes.io/instance=argo-workflows,kubernetes.io/metadata.name=argo-workflows
argocd                   Active       5y18d    kubernetes.io/metadata.name=argocd
beta                     Not Active   4y235d   kubernetes.io/metadata.name=beta

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions