|
| 1 | +#!/bin/bash |
| 2 | +##===----------------------------------------------------------------------===## |
| 3 | +## |
| 4 | +## This source file is part of the Swift Argument Parser open source project |
| 5 | +## |
| 6 | +## Copyright (c) 2020 Apple Inc. and the Swift project authors |
| 7 | +## Licensed under Apache License v2.0 with Runtime Library Exception |
| 8 | +## |
| 9 | +## See https://swift.org/LICENSE.txt for license information |
| 10 | +## |
| 11 | +##===----------------------------------------------------------------------===## |
| 12 | + |
| 13 | +read -p "This will replace your current pasteboard. Continue? [y/n]" -n 1 -r |
| 14 | +echo # (optional) move to a new line |
| 15 | +if [[ $REPLY =~ ^[Yy]$ ]] |
| 16 | +then |
| 17 | + swiftversion=$(swift --version) |
| 18 | + unix_version_name=$(uname -a | tr ";" '\n') |
| 19 | + i="${i}Swift version: ${swiftversion}\n" |
| 20 | + i="${i}Unix version: ${unix_version_name}\n" |
| 21 | + |
| 22 | + # Check if OS is macOS, if so retrieve which version and Xcode version. |
| 23 | + if [[ "$OSTYPE" == "darwin"* ]]; then |
| 24 | + macos=$(defaults read loginwindow SystemVersionStampAsString | cat -) |
| 25 | + xcodebuild_version=$(/usr/bin/xcodebuild -version | grep Xcode) |
| 26 | + xcodebuild_build=$(/usr/bin/xcodebuild -version | grep Build) |
| 27 | + xcodeselectpath=$(xcode-select -p | cat -) |
| 28 | + |
| 29 | + i="${i}\nmacOS version: ${macos}\n" |
| 30 | + i="${i}Xcode-select path: '${xcodeselectpath}\n" |
| 31 | + i="${i}Xcode: ${xcodebuild_version} (${xcodebuild_build})" |
| 32 | + fi |
| 33 | + |
| 34 | + echo -e "${i}" | pbcopy |
| 35 | + echo "Your pasteboard now contains debug info, paste it on Github" |
| 36 | +fi |
| 37 | + |
0 commit comments