Giter Club home page Giter Club logo

Comments (6)

ClementTsang avatar ClementTsang commented on May 22, 2024 1

Ah, okay. Thought you meant something like, if you run say btm -a with no config file it would generate a config file with the average_cpu flag set to true.

Looks good then!

from bottom.

shilangyu avatar shilangyu commented on May 22, 2024

If you accept contributions I would like to tackle this issue, seems like a good first issue

from bottom.

ClementTsang avatar ClementTsang commented on May 22, 2024

Sure! I thought about doing this originally but wasn't sure what a good way to tackle this was.

from bottom.

shilangyu avatar shilangyu commented on May 22, 2024

The approach I have been using in my projects that use config files is the following:

  • the program starts
  • looks for a config file
    • if it exists, load the config
    • if it does not exist, create it with a ready config that has comments around each field (similar to alacritty) and load it
  • overwrite the config with commandline flags
  • use defaults for missing fields

What do you think?

EDIT: meant override, not overwrite

from bottom.

ClementTsang avatar ClementTsang commented on May 22, 2024

overwrite the config with commandline flags

While I like the idea behind this part, it's kinda 50/50 for me. I'm just not 100% on setting values for the user without them explicitly knowing that they're set, especially since if an option is set to true on the config file, then there's no way to actually turn the thing off from the command line - only on.

So either notifying the user what values are set, or just (imo the easier solution I guess) leaving it default entirely if we create one is probably what I would rather do.

The rest of it I like though.

from bottom.

shilangyu avatar shilangyu commented on May 22, 2024

What I meant by overwrite the config with commandline flags is what is already currently implemented. If my config file says the temperature should be Kelvin, but I run bottom with btm -c it will prioritize the Celsius flag and show the temperature in Celsius

from bottom.

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.