Code Monkey home page Code Monkey logo

Comments (1)

chrisallenlane avatar chrisallenlane commented on June 7, 2024

@Almenon, thanks for the bug report, and sorry for my delay getting back to you.

I can reproduce this behavior, but I consider this to be a feature and not a bug, and I don't plan to change the current behavior. I'll explain my reasoning.

As you've discovered, this error occurs when cheat attempts to load a cheatsheet that contains malformed front-matter. There are essentially only four behaviors that we could implement here:

  1. Fail with an explicit error message. (This is the current behavior.)
  2. Entirely ignore the cheatsheet with the malformed front-matter
  3. Discard the malformed front-matter, but otherwise attempt to use the cheatsheet.
  4. Discord the malformed front-matter, write a warning to stderr, and attempt to use the cheatsheet.

Of the four, I think option one - the current behavior - is preferable.

If we pursue option two, we'll inevitably "hide" cheatsheets from users as they become malformed through editing. Worse, we'll also hide the fact that we're hiding them! The user will simply be unaware that their cheatsheets contain errors, and that they're being silently ignored.

If we pursue option three, cheatsheet content will still be searchable (via -s), but tagging will be silently broken. And, once again, the user will be unaware that there's a problem.

Option four perhaps improves upon option three, but there's still a risk that the user simply does not see the error written to stderr. This risk increases with the length of a cheatsheet, and some cheatsheets can be quite long.

With all of that said, I think the "hard" failure is probably best for the user in the long-term, if inconvenient in the short-term (in that a user will be required to fix their cheatsheets immediately, prior to resuming their use of cheat).

I'm going to close this ticket, but I'm open to feedback if you have a differing opinion, and/or other suggestions for behaviors that I have not considered above.

Thanks.

from cheat.

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.