Skip to content

Conversation

@mamantoha
Copy link
Contributor

@mamantoha mamantoha commented Dec 18, 2025

  • Adds a new option @dracula-weather-hide-errors for the weather plugin.
  • When enabled, the weather widget prints an empty string on connectivity/API errors instead of "Weather Unavailable" / "Unknown Location".
  • This works nicely with set -g @dracula-show-empty-plugins false to hide the weather segment entirely when it can’t be fetched.

Config example:

set -g @dracula-show-empty-plugins false
set -g @dracula-weather-hide-errors true

No more "Weather Unavailable":

Screenshot_20251218_192041

@coderabbitai
Copy link

coderabbitai bot commented Dec 18, 2025

📝 Walkthrough

Walkthrough

Threads a new tmux option dracula-weather-hide-errors (default false) from scripts/dracula.sh through scripts/weather_wrapper.sh into scripts/weather.sh, adding an option to suppress weather error output on timeouts and fetch failures.

Changes

Cohort / File(s) Summary
Dracula config / option
scripts/dracula.sh
Adds dracula-weather-hide-errors tmux option (default false) and includes it in the weather plugin invocation.
Wrapper argument plumbing
scripts/weather_wrapper.sh
Adds local _hide_errors, adjusts parameter handling (shifts positional arguments), and forwards the hide-errors flag to scripts/weather.sh.
Weather logic
scripts/weather.sh
Extends main signature to accept a fourth optional parameter (hide_errors); when true, silences error output on timeouts and fetch failures while preserving successful output.
Docs
docs/CONFIG.md
Documents the new dracula-weather-hide-errors setting with description and example usage.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant TM as tmux / scripts/dracula.sh
    participant Wrapper as scripts/weather_wrapper.sh
    participant Weather as scripts/weather.sh

    TM->>Wrapper: invoke weather plugin (show_fahrenheit, show_location, weather_hide_errors, fixed_location)
    Wrapper->>Weather: call main(show_fahrenheit, show_location, location, hide_errors)
    alt Weather fetch succeeds
        Weather-->>Wrapper: weather output
        Wrapper-->>TM: render weather output
    else Timeout or fetch failure
        alt hide_errors = false
            Weather-->>Wrapper: "Weather Unavailable" / "Unknown Location"
            Wrapper-->>TM: render error message
        else hide_errors = true
            Weather-->>Wrapper: (no output)
            Wrapper-->>TM: (no weather output rendered)
        end
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Verify positional argument ordering across scripts/dracula.shscripts/weather_wrapper.shscripts/weather.sh.
  • Confirm there are no other callers of scripts/weather.sh that need updating for the additional parameter.
  • Check that hiding errors doesn't create layout/spacing issues when output is omitted.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately captures the main change: adding an option to hide weather error messages by producing empty output instead.
Description check ✅ Passed The description clearly explains the new option, its purpose, usage with complementary settings, includes configuration examples, and provides visual evidence of the feature working as intended.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1c6e2a2 and 3771d40.

📒 Files selected for processing (1)
  • scripts/weather_wrapper.sh (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • scripts/weather_wrapper.sh

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
scripts/weather_wrapper.sh (1)

14-17: Update function documentation to reflect the new parameter.

The documentation lists only three arguments, but the function now accepts four parameters after adding _hide_errors. Update the comment block to include the new parameter.

🔎 Apply this diff to update the documentation:
 # Arguments:
 #   show fahrenheit, either "true" (default) or "false"
 #   show location, either "true" (default) or "false"
+#   hide errors, either "true" or "false" (default)
 #   optional fixed location to query data about, e.g. "Houston, Texas"
scripts/weather.sh (1)

93-96: Update function documentation to reflect the new parameter.

The documentation lists only three arguments, but the function now accepts four parameters. Update the comment block to include the new hide_errors parameter.

🔎 Apply this diff to update the documentation:
 # Arguments
 #   show fahrenheit, either "true" (default) or "false"
 #   show location, either "true" (default) or "false"
 #   optional fixed location to query data about, e.g. "Houston, Texas"
+#   hide errors, either "true" or "false" (default)
🧹 Nitpick comments (1)
scripts/weather.sh (1)

118-121: LGTM! Consider simplifying the empty output.

The error suppression logic is correct with the early return preventing subsequent error messages. The implementation aligns well with the PR objectives.

💡 Optional simplification

Since printf '' outputs nothing, you could simplify by removing it:

 if "$_hide_errors"; then
-  printf ''
   return
 fi

This is purely stylistic and doesn't affect functionality.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 857ce1f and a19f3be.

📒 Files selected for processing (3)
  • scripts/dracula.sh (2 hunks)
  • scripts/weather.sh (1 hunks)
  • scripts/weather_wrapper.sh (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
scripts/dracula.sh (1)
scripts/utils.sh (1)
  • get_tmux_option (3-12)
🔇 Additional comments (6)
scripts/weather_wrapper.sh (2)

19-23: LGTM!

The argument handling correctly receives the new _hide_errors parameter and maintains proper ordering for all four parameters.


30-30: LGTM!

The invocation correctly passes all four parameters to weather.sh in the expected order: show_fahrenheit, show_location, location, hide_errors.

scripts/dracula.sh (2)

21-21: LGTM!

The new option is correctly retrieved with an appropriate default value of false, ensuring backward compatibility.


314-314: LGTM!

The weather wrapper invocation correctly passes the new weather_hide_errors parameter in the proper position, and the fixed_location remains properly quoted to handle location names with spaces.

scripts/weather.sh (2)

98-102: LGTM!

The parameter handling correctly receives and assigns the _hide_errors flag with an appropriate default value of false.


106-110: LGTM!

The timeout error handling correctly suppresses the error message when _hide_errors is true, enabling the empty output behavior described in the PR objectives.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5d4f686 and 1c6e2a2.

📒 Files selected for processing (2)
  • scripts/weather.sh (1 hunks)
  • scripts/weather_wrapper.sh (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • scripts/weather.sh
🔇 Additional comments (1)
scripts/weather_wrapper.sh (1)

31-31: Argument reordering is intentional but depends on verification.

The wrapper receives arguments in the order (fahrenheit, location_toggle, hide_errors, location) but calls weather.sh with (fahrenheit, location_toggle, location, hide_errors). This reordering maintains location as weather.sh's 3rd parameter while adding hide_errors as a new 4th parameter, which appears to preserve weather.sh's backward compatibility.

This implementation is correct if:

  1. All callers of weather_wrapper.sh pass arguments in the new order
  2. weather.sh correctly accepts hide_errors as the 4th parameter

The verification script in the previous comment will confirm both conditions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant