Skip to content

error when no key precised #3

Closed
@MainHanzo

Description

@MainHanzo

the tool works well when we have a id precised by user as the key. However I think when the user doesn't use the '--key' option, it's not working as expected.

for example:
----1.csv----
"""id,name,age
1,Cleo,5
2,Pancakes,2"""

----2.csv----
"""id,name,age
1,Cleo,5
2,Pancakes,3"""

and we launch with no key option :
csv-diff 1.csv 2.csv
we will get:
"2 rows added, 2 rows removed

2 rows added

id: 1
name: Cleo
age: 5

id: 2
name: Pancakes
age: 2

2 rows removed

id: 1
name: Cleo
age: 5

id: 2
name: Pancakes
age: 4

"

while i expect this:
"
1 row added, 1 row removed
1 row added:
id:2
name: Pancakes
age: 2
1 row removed:
id: 2
name: Pancakes
age: 4

"

the problem is caused because that the hash of the line is stored as a hash object, and even two lines are the same content, the memo locations are different. So they are different objects.

I have corrected this feature, if you like, I can upload it through a pull request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions