Skip to content

Commit

Permalink
Improve color detection. Migrate project to Xcode 14.2.
Browse files Browse the repository at this point in the history
  • Loading branch information
objecthub committed Jan 30, 2023
1 parent 6b1af62 commit c66994d
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

# 0.3.5 (2023-01-29)
- Be more clever about detecting color terminals
- Migrate project to Xcode 14.2

## 0.3.4 (2021-05-12)
- Minor bug fixes
- Migrated project to Xcode 12.5
Expand Down
12 changes: 11 additions & 1 deletion CommandLineKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0930;
LastUpgradeCheck = 1200;
LastUpgradeCheck = 1420;
ORGANIZATIONNAME = "Matthias Zenger";
TargetAttributes = {
CC7A60E6207A62A5007376A0 = {
Expand Down Expand Up @@ -418,6 +418,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "-";
COPY_PHASE_STRIP = NO;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
Expand Down Expand Up @@ -473,6 +474,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "-";
COPY_PHASE_STRIP = NO;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
Expand All @@ -498,6 +500,7 @@
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = C72Z63N8M5;
INFOPLIST_FILE = "$(SRCROOT)/Sources/CommandLineKitDemo/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
Expand All @@ -518,6 +521,7 @@
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = C72Z63N8M5;
INFOPLIST_FILE = "$(SRCROOT)/Sources/CommandLineKitDemo/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
Expand Down Expand Up @@ -556,6 +560,7 @@
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1;
DEAD_CODE_STRIPPING = YES;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = C72Z63N8M5;
DYLIB_COMPATIBILITY_VERSION = 1;
Expand All @@ -570,6 +575,7 @@
"@executable_path/../Frameworks",
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
PRODUCT_BUNDLE_IDENTIFIER = net.objecthub.CommandLineKit;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
Expand Down Expand Up @@ -605,6 +611,7 @@
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1;
DEAD_CODE_STRIPPING = YES;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = C72Z63N8M5;
DYLIB_COMPATIBILITY_VERSION = 1;
Expand All @@ -619,6 +626,7 @@
"@executable_path/../Frameworks",
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
PRODUCT_BUNDLE_IDENTIFIER = net.objecthub.CommandLineKit;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
Expand Down Expand Up @@ -652,6 +660,7 @@
CODE_SIGN_IDENTITY = "Mac Developer";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = C72Z63N8M5;
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = Tests/CommandLineKitTests/Info.plist;
Expand Down Expand Up @@ -691,6 +700,7 @@
CODE_SIGN_IDENTITY = "Mac Developer";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = C72Z63N8M5;
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = Tests/CommandLineKitTests/Info.plist;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1200"
LastUpgradeVersion = "1420"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1200"
LastUpgradeVersion = "1420"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import PackageDescription
let package = Package(
name: "CommandLineKit",
platforms: [
.macOS(.v10_12)
.macOS(.v10_13)
],
products: [
.library(name: "CommandLineKit", targets: ["CommandLineKit"]),
Expand Down
9 changes: 9 additions & 0 deletions Sources/CommandLineKit/Terminal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ public struct Terminal {
public static let current: String = ProcessInfo.processInfo.environment["TERM"] ?? ""

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

Expand Down
2 changes: 1 addition & 1 deletion Sources/CommandLineKitDemo/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2018 Google LLC</string>
<string>Copyright © 2018-2023 Google LLC</string>
</dict>
</plist>

0 comments on commit c66994d

Please sign in to comment.