Git Product home page Git Product logo

Comments (7)

winterjung avatar winterjung commented on May 18, 2024 2

How about this way? I think it can do what you want.

with Halo(spinner='dots') as spinner:
   for f in files_to_load():
        spinner.text = 'Loading {}'.format(f)
        do_load_file(f)

from halo.

steelman avatar steelman commented on May 18, 2024

This isn't a bad solution, however, it doesn't work if there is nothing like a filename to show and I still want the spinner to be updated once a loop.

from halo.

manrajgrover avatar manrajgrover commented on May 18, 2024

@steelman Thanks for opening this. Could you add an example to your second comment?

from halo.

steelman avatar steelman commented on May 18, 2024

Tough question. Nothing in particular comes to my mind, so let my try theoretic cases.

  1. Very long labels which don't hold usable information for users (e.g. cryptographic keys)
  2. An unsorted or infinite set of data (so users can't determine progress)
  3. An event loop or waiting for a network connection to be established.

from halo.

manrajgrover avatar manrajgrover commented on May 18, 2024

@steelman I'm getting what you're saying. See, this is what spinner.text is for. If we need to step in every iteration, let's say for percentage, we would need to know the length of the iterable. For that, we need to add a wrapper which handles iterations and updates the text. But we can only do it for iterables.

from halo.

steelman avatar steelman commented on May 18, 2024

At this moment halo satisfies my needs so, most probably, I won't develop any solution to the problem I described. However, I imagine, you may want to keep this issue open, so if anybody comes looking for an inspiration for a contribution, they will find one.

from halo.

foster999 avatar foster999 commented on May 18, 2024

Happy to update #132 and check it still works, if the feature might still be of interest @manrajgrover?

from halo.

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.