mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Add progress spinner animation during generation
This is a first step at enriching console output via the `rich` project.
This commit is contained in:
parent
14afc6c54a
commit
40f3d2df91
3 changed files with 7 additions and 2 deletions
|
|
@ -13,6 +13,8 @@ from collections.abc import Iterable
|
||||||
from pkgutil import extend_path
|
from pkgutil import extend_path
|
||||||
__path__ = extend_path(__path__, __name__)
|
__path__ = extend_path(__path__, __name__)
|
||||||
|
|
||||||
|
from rich.console import Console
|
||||||
|
|
||||||
# pelican.log has to be the first pelican module to be loaded
|
# pelican.log has to be the first pelican module to be loaded
|
||||||
# because logging.setLoggerClass has to be called before logging.getLogger
|
# because logging.setLoggerClass has to be called before logging.getLogger
|
||||||
from pelican.log import init as init_logging
|
from pelican.log import init as init_logging
|
||||||
|
|
@ -35,6 +37,7 @@ except Exception:
|
||||||
|
|
||||||
DEFAULT_CONFIG_NAME = 'pelicanconf.py'
|
DEFAULT_CONFIG_NAME = 'pelicanconf.py'
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
console = Console()
|
||||||
|
|
||||||
|
|
||||||
class Pelican:
|
class Pelican:
|
||||||
|
|
@ -524,7 +527,8 @@ def main(argv=None):
|
||||||
else:
|
else:
|
||||||
watcher = FileSystemWatcher(args.settings, Readers, settings)
|
watcher = FileSystemWatcher(args.settings, Readers, settings)
|
||||||
watcher.check()
|
watcher.check()
|
||||||
pelican.run()
|
with console.status("Generating..."):
|
||||||
|
pelican.run()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
logger.warning('Keyboard interrupt received. Exiting.')
|
logger.warning('Keyboard interrupt received. Exiting.')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ jinja2 = ">=2.7"
|
||||||
pygments = ">=2.6"
|
pygments = ">=2.6"
|
||||||
python-dateutil = ">=2.8"
|
python-dateutil = ">=2.8"
|
||||||
pytz = ">=2020.1"
|
pytz = ">=2020.1"
|
||||||
|
rich = ">=10.1"
|
||||||
unidecode = ">=1.1"
|
unidecode = ">=1.1"
|
||||||
markdown = {version = ">=3.1", optional = true}
|
markdown = {version = ">=3.1", optional = true}
|
||||||
|
|
||||||
|
|
|
||||||
2
setup.py
2
setup.py
|
|
@ -10,7 +10,7 @@ version = "4.6.0"
|
||||||
|
|
||||||
requires = ['feedgenerator >= 1.9', 'jinja2 >= 2.7', 'pygments',
|
requires = ['feedgenerator >= 1.9', 'jinja2 >= 2.7', 'pygments',
|
||||||
'docutils>=0.15', 'pytz >= 0a', 'blinker', 'unidecode',
|
'docutils>=0.15', 'pytz >= 0a', 'blinker', 'unidecode',
|
||||||
'python-dateutil']
|
'python-dateutil', 'rich']
|
||||||
|
|
||||||
entry_points = {
|
entry_points = {
|
||||||
'console_scripts': [
|
'console_scripts': [
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue