-
-
Notifications
You must be signed in to change notification settings - Fork 960
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Repurpose Xcode and Swift sections to use native tools #1372
Comments
Examples of the new sections: Xcode#
# Xcode
#
# Xcode is a suite of tools developers use to build apps for Apple platforms.
# Link: https://developer.apple.com/xcode/
HAMMER=$'\xF0\x9F\x94\xA8'
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
SPACESHIP_XCODE_SHOW="${SPACESHIP_XCODE_SHOW=true}"
SPACESHIP_XCODE_ASYNC="${SPACESHIP_XCODE_ASYNC=true}"
SPACESHIP_XCODE_PREFIX="${SPACESHIP_XCODE_PREFIX="$SPACESHIP_PROMPT_DEFAULT_PREFIX"}"
SPACESHIP_XCODE_SUFFIX="${SPACESHIP_XCODE_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}"
SPACESHIP_XCODE_SYMBOL="${SPACESHIP_XCODE_SYMBOL="$HAMMER "}"
SPACESHIP_XCODE_COLOR="${SPACESHIP_XCODE_COLOR="blue"}"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
spaceship_xcode() {
[[ $SPACESHIP_XCODE_SHOW == false ]] && return
spaceship::upsearch -s "*.xcworkspace" "*.xcodeproj" "Package.swift" || return
spaceship::exists xed || return
local xcode_version=$(xed --version | awk '{ print $NF }')
[[ -z $xcode_version ]] && return
spaceship::section::v4 \
--color "$SPACESHIP_XCODE_COLOR" \
--prefix "$SPACESHIP_XCODE_PREFIX" \
--suffix "$SPACESHIP_XCODE_SUFFIX" \
--symbol "$SPACESHIP_XCODE_SYMBOL" \
"v$xcode_version"
} Swift#
# Swift
#
# Swift is a powerful and intuitive programming language for all Apple platforms.
# Link: https://developer.apple.com/swift/
BIRD=$'\xF0\x9F\x90\xA6'
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
SPACESHIP_SWIFT_SHOW="${SPACESHIP_SWIFT_SHOW=true}"
SPACESHIP_SWIFT_ASYNC="${SPACESHIP_SWIFT_ASYNC=true}"
SPACESHIP_SWIFT_PREFIX="${SPACESHIP_SWIFT_PREFIX="$SPACESHIP_PROMPT_DEFAULT_PREFIX"}"
SPACESHIP_SWIFT_SUFFIX="${SPACESHIP_SWIFT_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}"
SPACESHIP_SWIFT_SYMBOL="${SPACESHIP_SWIFT_SYMBOL="$BIRD "}"
SPACESHIP_SWIFT_COLOR="${SPACESHIP_SWIFT_COLOR="yellow"}"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
spaceship_swift() {
[[ $SPACESHIP_SWIFT_SHOW == false ]] && return
spaceship::upsearch -s "*.xcworkspace" "*.xcodeproj" "Package.swift" || return
spaceship::exists swift || return
local swift_version=$(swift --version 2>/dev/null | head -n 1 | sed -En 's/^.*Apple Swift version (([[:digit:]]+\.)*[[:digit:]]+).*$/\1/ip')
[[ -z $swift_version ]] && return
spaceship::section::v4 \
--color "$SPACESHIP_SWIFT_COLOR" \
--prefix "$SPACESHIP_SWIFT_PREFIX" \
--suffix "$SPACESHIP_SWIFT_SUFFIX" \
--symbol "$SPACESHIP_SWIFT_SYMBOL" \
"v$swift_version"
} |
The ✨ emoji should be considered as an alternative for the Swift section.
|
Please let me know if this proposal is approved before I create the accompanying pull request. Thank you! |
@denysdovhan May you please approve this proposal? I was not planning to submit pull requests until the proposal is approved so that I am able to incorporate your feedback before coding. Thank you! |
@denysdovhan Would you kindly be able to please approve this proposal before I begin creating the accompanying pull request? Thank you! |
@denysdovhan I am checking in again to see if you may approve this proposal. Thank you! |
The problem
The Xcode and Swift sections depend upon 3rd party tools, namely
xcenv
andswiftenv
, that require manual installation, are not strictly necessary and are not ubiquitious.Describe the solution you'd like
Rename the Xcode section from "xcode" to "xcenv" and rename the Swift section from "swift" to "swiftenv" and move them both to the registry (likely also requiring moving them to another repo).
Then repurpose the "xcode" and "swift" names for brand new sections that rely solely on the 1st party Apple provided commands
xed --version
andswift --version
.The new sections will not support the local/global configs that the existing sections do. This means that this would be a breaking change for anyone using the local/global configs which would require manually switching to using the "xcenv" / "swiftenv" commands.
Describe alternatives you've considered
xed --version
andswift --version
whenxcenv
andswiftenv
are not installed.Documentation
The docs for the new sections would be almost identical to the existing sections with the following modifications:
The text was updated successfully, but these errors were encountered: