Skip to content

Commit c74cfd5

Browse files
committed
updated help text and build settings
1 parent b76e198 commit c74cfd5

File tree

3 files changed

+61
-6
lines changed

3 files changed

+61
-6
lines changed

diskspace.xcodeproj/project.pbxproj

+15-4
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@
9494
isa = PBXProject;
9595
attributes = {
9696
BuildIndependentTargetsInParallel = 1;
97+
KnownAssetTags = (
98+
New,
99+
);
97100
LastSwiftUpdateCheck = 1310;
98101
LastUpgradeCheck = 1310;
99102
TargetAttributes = {
@@ -186,7 +189,8 @@
186189
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
187190
GCC_WARN_UNUSED_FUNCTION = YES;
188191
GCC_WARN_UNUSED_VARIABLE = YES;
189-
MACOSX_DEPLOYMENT_TARGET = 12.0;
192+
MACOSX_DEPLOYMENT_TARGET = 10.14;
193+
MARKETING_VERSION = 1;
190194
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
191195
MTL_FAST_MATH = YES;
192196
ONLY_ACTIVE_ARCH = YES;
@@ -241,7 +245,8 @@
241245
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
242246
GCC_WARN_UNUSED_FUNCTION = YES;
243247
GCC_WARN_UNUSED_VARIABLE = YES;
244-
MACOSX_DEPLOYMENT_TARGET = 12.0;
248+
MACOSX_DEPLOYMENT_TARGET = 10.14;
249+
MARKETING_VERSION = 1;
245250
MTL_ENABLE_DEBUG_INFO = NO;
246251
MTL_FAST_MATH = YES;
247252
SDKROOT = macosx;
@@ -253,21 +258,27 @@
253258
C6F43F072731718900747000 /* Debug */ = {
254259
isa = XCBuildConfiguration;
255260
buildSettings = {
256-
CODE_SIGN_STYLE = Automatic;
261+
CODE_SIGN_IDENTITY = "Developer ID Application";
262+
CODE_SIGN_STYLE = Manual;
257263
DEVELOPMENT_TEAM = JME5BW3F3R;
258264
ENABLE_HARDENED_RUNTIME = YES;
265+
PRODUCT_BUNDLE_IDENTIFIER = com.scriptingosx.diskspace;
259266
PRODUCT_NAME = "$(TARGET_NAME)";
267+
PROVISIONING_PROFILE_SPECIFIER = "";
260268
SWIFT_VERSION = 5.0;
261269
};
262270
name = Debug;
263271
};
264272
C6F43F082731718900747000 /* Release */ = {
265273
isa = XCBuildConfiguration;
266274
buildSettings = {
267-
CODE_SIGN_STYLE = Automatic;
275+
CODE_SIGN_IDENTITY = "Developer ID Application";
276+
CODE_SIGN_STYLE = Manual;
268277
DEVELOPMENT_TEAM = JME5BW3F3R;
269278
ENABLE_HARDENED_RUNTIME = YES;
279+
PRODUCT_BUNDLE_IDENTIFIER = com.scriptingosx.diskspace;
270280
PRODUCT_NAME = "$(TARGET_NAME)";
281+
PROVISIONING_PROFILE_SPECIFIER = "";
271282
SWIFT_VERSION = 5.0;
272283
};
273284
name = Release;

diskspace.xcodeproj/xcshareddata/xcschemes/diskspace.xcscheme

+23-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
33
LastUpgradeVersion = "1310"
4-
version = "1.3">
4+
version = "1.7">
55
<BuildAction
66
parallelizeBuildables = "YES"
77
buildImplicitDependencies = "YES">
@@ -53,6 +53,10 @@
5353
<CommandLineArguments>
5454
<CommandLineArgument
5555
argument = "--human-readable"
56+
isEnabled = "NO">
57+
</CommandLineArgument>
58+
<CommandLineArgument
59+
argument = "--help"
5660
isEnabled = "YES">
5761
</CommandLineArgument>
5862
</CommandLineArguments>
@@ -80,5 +84,23 @@
8084
<ArchiveAction
8185
buildConfiguration = "Release"
8286
revealArchiveInOrganizer = "YES">
87+
<PostActions>
88+
<ExecutionAction
89+
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
90+
<ActionContent
91+
title = "Run Script"
92+
scriptText = "# Developer ID Installer cert name&#10;sign_cert=&quot;Developer ID Installer: Armin Briegel (JME5BW3F3R)&quot;&#10;# profile name used with `notarytool --store-credentials`&#10;credential_profile=&quot;notary-scriptingosx&quot;&#10;&#10;# data from build settings&#10;pkg_name=&quot;$PRODUCT_NAME&quot;&#10;identifier=&quot;$PRODUCT_BUNDLE_IDENTIFIER&quot;&#10;version=&quot;$MARKETING_VERSION&quot;&#10;&#10;PKG_PATH=&quot;$SRCROOT/$pkg_name-$version.pkg&quot;&#10;NOTARY_LOG=&quot;$SRCROOT/notary.log&quot;&#10;&#10;echo &quot;Packaging and Notarizing &apos;$pkg_name&apos;, version: $version&quot; &gt; &quot;$NOTARY_LOG&quot;&#10;date +&quot;%F %T&quot; &gt;&gt; &quot;$NOTARY_LOG&quot;&#10;echo &gt;&gt; &quot;$NOTARY_LOG&quot;&#10;&#10;# usually use `xcodebuild -exportArchive` to get&#10;# the product out of the archive. However, this does not work&#10;# with a command line tool, so we are going direct&#10;PKG_ROOT=&quot;$ARCHIVE_PATH/Products/&quot;&#10;&#10;# create the pkg&#10;pkgbuild --root &quot;$PKG_ROOT&quot; \&#10; --identifier &quot;$identifier&quot; \&#10; --version &quot;$version&quot; \&#10; --install-location &quot;/&quot; \&#10; --sign &quot;$sign_cert&quot; \&#10; &quot;$PKG_PATH&quot; &gt;&gt; &quot;$NOTARY_LOG&quot; 2&gt;&amp;1&#10;echo &gt;&gt; &quot;$NOTARY_LOG&quot;&#10;&#10;# notarize&#10;xcrun notarytool submit &quot;$PKG_PATH&quot; \&#10; --keychain-profile &quot;$credential_profile&quot; \&#10; --wait &gt;&gt; &quot;$NOTARY_LOG&quot; 2&gt;&amp;1&#10;echo &gt;&gt; &quot;$NOTARY_LOG&quot;&#10;&#10;# staple&#10;xcrun stapler staple &quot;$PKG_PATH&quot; &gt;&gt; &quot;$NOTARY_LOG&quot; 2&gt;&amp;1&#10;&#10;# reveal in Finder&#10;open -R &quot;$PKG_PATH&quot;&#10;">
93+
<EnvironmentBuildable>
94+
<BuildableReference
95+
BuildableIdentifier = "primary"
96+
BlueprintIdentifier = "C6F43EFE2731718900747000"
97+
BuildableName = "diskspace"
98+
BlueprintName = "diskspace"
99+
ReferencedContainer = "container:diskspace.xcodeproj">
100+
</BuildableReference>
101+
</EnvironmentBuildable>
102+
</ActionContent>
103+
</ExecutionAction>
104+
</PostActions>
83105
</ArchiveAction>
84106
</Scheme>

diskspace/main.swift

+23-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,23 @@ import ArgumentParser
1212
// https://developer.apple.com/documentation/foundation/urlresourcekey/checking_volume_storage_capacity
1313

1414
struct DiskSpace : ParsableCommand {
15+
static let configuration = CommandConfiguration(
16+
commandName: "diskspace",
17+
abstract: "Returns available disk space",
18+
discussion: """
19+
With the various APFS features the value for free disk space returned from tools such as `du` or `df` will not be accurate. This tool uses system functions to get various measures of available disk space.
20+
21+
The 'Important' value matches the free disk space value shown in Finder.
22+
23+
You can get the details from Apple's documentation:
24+
25+
https://developer.apple.com/documentation/foundation/urlresourcekey/checking_volume_storage_capacity
26+
""",
27+
version: "1"
28+
)
29+
30+
// MARK: Flags and Arguments
31+
1532
@Flag(name: [.customShort("H"), .long],
1633
help: "Human readable output using unit suffixes")
1734
var humanReadable = false
@@ -29,11 +46,13 @@ struct DiskSpace : ParsableCommand {
2946
var opportunistic = false
3047

3148
@Flag(name: .shortAndLong,
32-
help: "Print only the value of the total Capacity")
49+
help: "Print only the value of the Total Capacity")
3350
var total = false
3451

3552
@Argument(help: "path to the volume") var volumePath = "/"
3653

54+
// MARK: Functions
55+
3756
func printValue(value int: Int, label: String? = nil) {
3857
printValue(value: Int64(int), label: label)
3958
}
@@ -55,6 +74,8 @@ struct DiskSpace : ParsableCommand {
5574
}
5675
}
5776

77+
// MARK: Run the command
78+
5879
func run() {
5980
let showAll = !(available || important || opportunistic || total)
6081

@@ -95,4 +116,5 @@ struct DiskSpace : ParsableCommand {
95116
}
96117
}
97118

119+
// call the struct's main function
98120
DiskSpace.main()

0 commit comments

Comments
 (0)