Giter Site home page Giter Site logo

Better diffs about commander HOT 4 OPEN

commander-cli avatar commander-cli commented on May 20, 2024
Better diffs

from commander.

Comments (4)

SimonBaeumer avatar SimonBaeumer commented on May 20, 2024 1

@dylanhitt What do you think about printing the diff as a table?

For each test a table:

Expected Operator Result
1 Equal 3
True Equal False
Hello contained in Hey World

As a summary:

Or as complete summary like this (maybe a readable like a sentence with the Operation column):

Test Expected Operation Result
it should be equal 1 does not equal 3
it is true True does not equal False
it contains hello Hello is not contained in Hey World

Some more ideas:

  • If a text is too long it will be cropped, i.e. after 100 characters
  • If a text is more than, i.e. 10 lines, it will be cropped
  • The operator is filled defined in the corresponding Matcher

The table would have the benefit that it is always consistent. The disadvantage is that it is not as verbose and detailed as it is currently.
Imho it could be one of many output formats for the result and will be added along the current one.

from commander.

dylanhitt avatar dylanhitt commented on May 20, 2024 1

Let's start with that. I was thinking about how to deal with large text files. A bit of a cop out but it would help, we could scan the string until we reach the first point where there is a difference and pinpoint that spot something like hello w^rld. Of course we could print something cleaner than this example. But i'd say switching to table would be best.

I like the second table a lot actually. I didn't quite pick up that could be read like a sentence when I first read it. I need to stop skimming text 🙃

from commander.

dylanhitt avatar dylanhitt commented on May 20, 2024 1

You don't necessarily have to print the whole string just the context and the area around it that is different, maybe include the line number where it is first different. I'm not really proposing we do this now, it was mainly just spitting out ideas.

from commander.

SimonBaeumer avatar SimonBaeumer commented on May 20, 2024

Yes, a good diff library would be very cool. But I think we can't achieve a good (human) readability and displaying the difference in the results.
For example what do we do if the diff is too big?

from commander.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.