Skip to content

Commit c66994d

Browse files
committed
Improve color detection. Migrate project to Xcode 14.2.
1 parent 6b1af62 commit c66994d

File tree

7 files changed

+28
-5
lines changed

7 files changed

+28
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
# 0.3.5 (2023-01-29)
4+
- Be more clever about detecting color terminals
5+
- Migrate project to Xcode 14.2
6+
37
## 0.3.4 (2021-05-12)
48
- Minor bug fixes
59
- Migrated project to Xcode 12.5

CommandLineKit.xcodeproj/project.pbxproj

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@
276276
isa = PBXProject;
277277
attributes = {
278278
LastSwiftUpdateCheck = 0930;
279-
LastUpgradeCheck = 1200;
279+
LastUpgradeCheck = 1420;
280280
ORGANIZATIONNAME = "Matthias Zenger";
281281
TargetAttributes = {
282282
CC7A60E6207A62A5007376A0 = {
@@ -418,6 +418,7 @@
418418
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
419419
CODE_SIGN_IDENTITY = "-";
420420
COPY_PHASE_STRIP = NO;
421+
DEAD_CODE_STRIPPING = YES;
421422
DEBUG_INFORMATION_FORMAT = dwarf;
422423
ENABLE_STRICT_OBJC_MSGSEND = YES;
423424
ENABLE_TESTABILITY = YES;
@@ -473,6 +474,7 @@
473474
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
474475
CODE_SIGN_IDENTITY = "-";
475476
COPY_PHASE_STRIP = NO;
477+
DEAD_CODE_STRIPPING = YES;
476478
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
477479
ENABLE_NS_ASSERTIONS = NO;
478480
ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -498,6 +500,7 @@
498500
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
499501
CODE_SIGN_IDENTITY = "-";
500502
CODE_SIGN_STYLE = Automatic;
503+
DEAD_CODE_STRIPPING = YES;
501504
DEVELOPMENT_TEAM = C72Z63N8M5;
502505
INFOPLIST_FILE = "$(SRCROOT)/Sources/CommandLineKitDemo/Info.plist";
503506
LD_RUNPATH_SEARCH_PATHS = (
@@ -518,6 +521,7 @@
518521
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
519522
CODE_SIGN_IDENTITY = "-";
520523
CODE_SIGN_STYLE = Automatic;
524+
DEAD_CODE_STRIPPING = YES;
521525
DEVELOPMENT_TEAM = C72Z63N8M5;
522526
INFOPLIST_FILE = "$(SRCROOT)/Sources/CommandLineKitDemo/Info.plist";
523527
LD_RUNPATH_SEARCH_PATHS = (
@@ -556,6 +560,7 @@
556560
CODE_SIGN_STYLE = Automatic;
557561
COMBINE_HIDPI_IMAGES = YES;
558562
CURRENT_PROJECT_VERSION = 1;
563+
DEAD_CODE_STRIPPING = YES;
559564
DEFINES_MODULE = YES;
560565
DEVELOPMENT_TEAM = C72Z63N8M5;
561566
DYLIB_COMPATIBILITY_VERSION = 1;
@@ -570,6 +575,7 @@
570575
"@executable_path/../Frameworks",
571576
"@loader_path/Frameworks",
572577
);
578+
MACOSX_DEPLOYMENT_TARGET = 10.14;
573579
PRODUCT_BUNDLE_IDENTIFIER = net.objecthub.CommandLineKit;
574580
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
575581
SKIP_INSTALL = YES;
@@ -605,6 +611,7 @@
605611
CODE_SIGN_STYLE = Automatic;
606612
COMBINE_HIDPI_IMAGES = YES;
607613
CURRENT_PROJECT_VERSION = 1;
614+
DEAD_CODE_STRIPPING = YES;
608615
DEFINES_MODULE = YES;
609616
DEVELOPMENT_TEAM = C72Z63N8M5;
610617
DYLIB_COMPATIBILITY_VERSION = 1;
@@ -619,6 +626,7 @@
619626
"@executable_path/../Frameworks",
620627
"@loader_path/Frameworks",
621628
);
629+
MACOSX_DEPLOYMENT_TARGET = 10.14;
622630
PRODUCT_BUNDLE_IDENTIFIER = net.objecthub.CommandLineKit;
623631
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
624632
SKIP_INSTALL = YES;
@@ -652,6 +660,7 @@
652660
CODE_SIGN_IDENTITY = "Mac Developer";
653661
CODE_SIGN_STYLE = Automatic;
654662
COMBINE_HIDPI_IMAGES = YES;
663+
DEAD_CODE_STRIPPING = YES;
655664
DEVELOPMENT_TEAM = C72Z63N8M5;
656665
GCC_C_LANGUAGE_STANDARD = gnu11;
657666
INFOPLIST_FILE = Tests/CommandLineKitTests/Info.plist;
@@ -691,6 +700,7 @@
691700
CODE_SIGN_IDENTITY = "Mac Developer";
692701
CODE_SIGN_STYLE = Automatic;
693702
COMBINE_HIDPI_IMAGES = YES;
703+
DEAD_CODE_STRIPPING = YES;
694704
DEVELOPMENT_TEAM = C72Z63N8M5;
695705
GCC_C_LANGUAGE_STANDARD = gnu11;
696706
INFOPLIST_FILE = Tests/CommandLineKitTests/Info.plist;

CommandLineKit.xcodeproj/xcshareddata/xcschemes/CommandLineKit.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1200"
3+
LastUpgradeVersion = "1420"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

CommandLineKit.xcodeproj/xcshareddata/xcschemes/CommandLineKitDemo.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1200"
3+
LastUpgradeVersion = "1420"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ import PackageDescription
4343
let package = Package(
4444
name: "CommandLineKit",
4545
platforms: [
46-
.macOS(.v10_12)
46+
.macOS(.v10_13)
4747
],
4848
products: [
4949
.library(name: "CommandLineKit", targets: ["CommandLineKit"]),

Sources/CommandLineKit/Terminal.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ public struct Terminal {
4141
public static let current: String = ProcessInfo.processInfo.environment["TERM"] ?? ""
4242

4343
public static var fullColorSupport: Bool {
44+
// First make sure we are not running within Xcode
45+
guard ProcessInfo.processInfo.environment["__XCODE_BUILT_PRODUCTS_DIR_PATHS"] == nil else {
46+
return false
47+
}
48+
// Next, check if there is an environment variable COLORTERM set to "truecolor"
49+
if let cterm = ProcessInfo.processInfo.environment["COLORTERM"], cterm == "truecolor" {
50+
return true
51+
}
52+
// Finally, apply some heuristics based on the current terminal
4453
return Terminal.fullColorSupport(terminal: Terminal.current)
4554
}
4655

Sources/CommandLineKitDemo/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@
2323
<key>LSMinimumSystemVersion</key>
2424
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
2525
<key>NSHumanReadableCopyright</key>
26-
<string>Copyright © 2018 Google LLC</string>
26+
<string>Copyright © 2018-2023 Google LLC</string>
2727
</dict>
2828
</plist>

0 commit comments

Comments
 (0)