Skip to content

Commit d51d8ba

Browse files
macmadeclaude
andcommitted
feat: Add a menu item to reload the configuration files
Add a "Reload Configurations" item to the status-bar menu so users can manually re-sync every stored configuration's remote formatter files instead of waiting for the launch / hourly-timer downloads. - ApplicationDelegate: reloadConfigurations(_:) calls download() on each stored configuration, reusing the existing launch/timer download path, which re-fetches over HTTPS and overwrites the shared cache. Fire-and- forget: download() self-coalesces while a download is already running. - MainMenu.xib: insert the item plus a trailing separator after the configuration list, in its own group above "Manage Configurations...". Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent db7d3f9 commit d51d8ba

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

XcodeFormat/Classes/ApplicationDelegate.swift

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,24 @@ public class ApplicationDelegate: NSObject, NSApplicationDelegate
379379
self.preferencesWindowController.window?.makeKeyAndOrderFront( sender )
380380
}
381381

382+
/// Re-downloads every stored configuration's formatter files into the
383+
/// shared cache.
384+
///
385+
/// Triggers the same download path used at launch and by the hourly timer,
386+
/// overwriting the cached files. Safe to invoke repeatedly: each
387+
/// configuration's `download()` self-coalesces while a download is already
388+
/// in progress.
389+
///
390+
/// - Parameter sender: The control that triggered the action.
391+
@IBAction
392+
public func reloadConfigurations( _ sender: Any? )
393+
{
394+
Preferences.shared.configurations.forEach
395+
{
396+
$0.download()
397+
}
398+
}
399+
382400
/// Opens the project's GitHub page in the default browser, beeping if the
383401
/// URL cannot be constructed.
384402
///

XcodeFormat/UI/Base.lproj/MainMenu.xib

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,13 @@
682682
<menu id="BIo-AU-9zh">
683683
<items>
684684
<menuItem isSeparatorItem="YES" id="EhO-ih-789"/>
685+
<menuItem title="Reload Configurations" id="rLd-Cf-g01">
686+
<modifierMask key="keyEquivalentModifierMask"/>
687+
<connections>
688+
<action selector="reloadConfigurations:" target="Voe-Tx-rLC" id="rLd-Cf-a01"/>
689+
</connections>
690+
</menuItem>
691+
<menuItem isSeparatorItem="YES" id="rLd-Cf-s01"/>
685692
<menuItem title="Manage Configurations..." id="M2X-6L-vcy">
686693
<modifierMask key="keyEquivalentModifierMask"/>
687694
<connections>

0 commit comments

Comments
 (0)