forked from vashpan/xcode-dev-cleaner
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UI: New window for installing command line tool
Let's see if Apple would accept that!
- Loading branch information
Showing
6 changed files
with
207 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
DevCleaner/View Controllers/Command Line Install Window/CommandLineInstall.storyboard
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="22505" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="IOw-Tz-miv"> | ||
<dependencies> | ||
<deployment identifier="macosx"/> | ||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22505"/> | ||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> | ||
</dependencies> | ||
<scenes> | ||
<!--Window Controller--> | ||
<scene sceneID="dtG-ri-Hu0"> | ||
<objects> | ||
<windowController id="IOw-Tz-miv" sceneMemberID="viewController"> | ||
<window key="window" title="Install Command Line Tool" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" id="PcP-Ci-hIX"> | ||
<windowStyleMask key="styleMask" titled="YES" closable="YES"/> | ||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/> | ||
<rect key="contentRect" x="360" y="1160" width="550" height="180"/> | ||
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1682"/> | ||
<value key="minSize" type="size" width="550" height="180"/> | ||
<value key="maxSize" type="size" width="550" height="180"/> | ||
<view key="contentView" id="NmM-SC-cKJ"> | ||
<rect key="frame" x="0.0" y="0.0" width="550" height="180"/> | ||
<autoresizingMask key="autoresizingMask"/> | ||
</view> | ||
<connections> | ||
<outlet property="delegate" destination="IOw-Tz-miv" id="eJY-MH-p03"/> | ||
</connections> | ||
</window> | ||
<connections> | ||
<segue destination="yq5-bk-7Jv" kind="relationship" relationship="window.shadowedContentViewController" id="Ht9-0G-qoI"/> | ||
</connections> | ||
</windowController> | ||
<customObject id="Kmi-VL-W9X" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/> | ||
</objects> | ||
<point key="canvasLocation" x="3" y="-412"/> | ||
</scene> | ||
<!--Command Line Install View Controller--> | ||
<scene sceneID="AwT-mk-LEj"> | ||
<objects> | ||
<viewController id="yq5-bk-7Jv" customClass="CommandLineInstallViewController" customModule="DevCleaner" customModuleProvider="target" sceneMemberID="viewController"> | ||
<view key="view" id="pup-2Z-Mdm"> | ||
<rect key="frame" x="0.0" y="0.0" width="550" height="180"/> | ||
<autoresizingMask key="autoresizingMask"/> | ||
<subviews> | ||
<textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="xEt-zf-91o"> | ||
<rect key="frame" x="18" y="144" width="186" height="16"/> | ||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> | ||
<textFieldCell key="cell" lineBreakMode="clipping" title="Installing command line tool" id="4qU-hr-6XY"> | ||
<font key="font" metaFont="systemBold"/> | ||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/> | ||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> | ||
</textFieldCell> | ||
</textField> | ||
<textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="fYT-Ej-Qcq"> | ||
<rect key="frame" x="18" y="88" width="514" height="48"/> | ||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> | ||
<textFieldCell key="cell" id="hwV-R4-kJl"> | ||
<font key="font" metaFont="system"/> | ||
<string key="title">You can use DevCleaner from the command line. To make it easier, you can link command line tool script to one of your directories in PATH, for example /usr/local/bin. | ||
|
||
</string> | ||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/> | ||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> | ||
</textFieldCell> | ||
</textField> | ||
<textField focusRingType="none" verticalHuggingPriority="750" fixedFrame="YES" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="i8R-Zd-Gr0"> | ||
<rect key="frame" x="20" y="56" width="510" height="24"/> | ||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/> | ||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" allowsUndo="NO" sendsActionOnEndEditing="YES" borderStyle="bezel" alignment="left" title="$ sudo ln -s /Applications/DevCleaner.app/Contents/Resources/dev-cleaner.sh /usr/local/bin/dev-cleaner" usesSingleLineMode="YES" bezelStyle="round" id="7Ur-jN-8pP"> | ||
<font key="font" size="12" name="Menlo-Regular"/> | ||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> | ||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> | ||
</textFieldCell> | ||
</textField> | ||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="k9S-TW-6bi"> | ||
<rect key="frame" x="228" y="20" width="95" height="18"/> | ||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/> | ||
<buttonCell key="cell" type="inline" title="Copy command" bezelStyle="inline" alignment="center" borderStyle="border" inset="2" id="dn0-jX-eaM"> | ||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> | ||
<font key="font" size="11" name=".SFNS-Semibold"/> | ||
</buttonCell> | ||
<connections> | ||
<action selector="copyCommand:" target="yq5-bk-7Jv" id="TbM-74-uia"/> | ||
</connections> | ||
</button> | ||
</subviews> | ||
</view> | ||
<connections> | ||
<outlet property="commandTextField" destination="i8R-Zd-Gr0" id="FmE-3n-Mz4"/> | ||
</connections> | ||
</viewController> | ||
<customObject id="IFY-B5-2js" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/> | ||
</objects> | ||
<point key="canvasLocation" x="3" y="37"/> | ||
</scene> | ||
</scenes> | ||
</document> |
48 changes: 48 additions & 0 deletions
48
...eaner/View Controllers/Command Line Install Window/CommandLineInstallViewController.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// | ||
// CommandLineInstallViewController.swift | ||
// DevCleaner | ||
// | ||
// Created by Konrad Kołakowski on 06/03/2024. | ||
// Copyright © 2024 One Minute Games. All rights reserved. | ||
// | ||
// DevCleaner is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation; either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// DevCleaner is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with DevCleaner. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
import Cocoa | ||
|
||
final class CommandLineInstallViewController: NSViewController { | ||
// MARK: Properties & outlets | ||
@IBOutlet weak var commandTextField: NSTextField! | ||
|
||
private var commandString: String { | ||
let appPath = Bundle.main.bundlePath | ||
|
||
return "sudo ln -s \(appPath)/Contents/Resources/dev-cleaner.sh /usr/local/bin/dev-cleaner" | ||
} | ||
|
||
// MARK: Initialization & overrides | ||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
self.commandTextField.stringValue = "$ " + self.commandString | ||
self.commandTextField.isSelectable = true | ||
} | ||
|
||
// MARK: Actions | ||
@IBAction func copyCommand(_ sender: Any) { | ||
let pasteboard = NSPasteboard.general | ||
pasteboard.clearContents() | ||
|
||
pasteboard.setString(self.commandString, forType: .string) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.