Skip to content

Commit

Permalink
feat: add ability to forcefully render a section synchronously
Browse files Browse the repository at this point in the history
  • Loading branch information
denysdovhan committed Aug 22, 2022
1 parent c18b0c7 commit 216f0f2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/core.zsh
Expand Up @@ -87,8 +87,11 @@ spaceship::core::async_callback() {
# Refreshes the cache of a section. If the section is async, it will be
# executed in a separate process.
# USAGE:
# spaceship::core::refresh_section [section]
# spaceship::core::refresh_section [--sync] [section]
spaceship::core::refresh_section() {
# Parse CLI options
zparseopts -E -D -sync=sync

local section="$1"

[[ -z $section ]] && return 1
Expand All @@ -104,7 +107,7 @@ spaceship::core::refresh_section() {
return 1
fi

if spaceship::is_section_async "$section"; then
if spaceship::is_section_async "$section" && [[ -z $sync ]]; then
SPACESHIP_JOBS+=("$section")
async_job "spaceship" "spaceship_${section}"
else
Expand Down

0 comments on commit 216f0f2

Please sign in to comment.