1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2025-04-10 10:51:51 +00:00

docs(install): fix typo and update indentation and whitespaces (#4941)

This commit is contained in:
Zhizhen He 2023-03-08 23:42:00 +08:00 committed by GitHub
parent 0c5b11da12
commit 000f5ed10d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 40 additions and 41 deletions

View File

@ -2,7 +2,7 @@
set -euo pipefail
# Envrionmental variables that need to be set. These are sane defaults
# Environmental variables that need to be set. These are sane defaults
# KEYCHAIN_ENTRY=AC_PASSWORD # Or whatever you picked for <AUTH_ITEM_NAME>
# RUNNER_TEMP=~/Library/Keychains/
# KEYCHAIN_FILENAME=login.keychain-db
@ -15,7 +15,7 @@ set -euo pipefail
# The identifier for the installer signing key. Can be a name or a fingerprint
# INSTALLATION_KEY_IDENT=E525359D0B5AE97B7B6F5BB465FEC872C117D681
usage(){
usage() {
echo "Builds, signs, and notarizes starship."
echo "Read readme.md in the script directory to see the assumptions the script makes."
echo "Usage: $0 <path-to-starship-binary> <path-to-docs-directory> <arch> [pkgname]"
@ -25,7 +25,7 @@ usage(){
echo "If no pkgname is provided, the package will be named starship-<version>-<arch>.pkg"
}
script_dir="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
source "$script_dir/common.sh"
if [[ -z ${KEYCHAIN_ENTRY+x} ]]; then

View File

@ -8,7 +8,7 @@ set -euo pipefail
# Usage: run this script, passing $1 to the repository path. The script assumes
# it is being run from within a starship repository if $1 is not provided.
usage(){
usage() {
echo "Builds a component package for macOS."
echo "Assumes that the following items already exist:"
echo " - A starship binary which has already been notarized"
@ -17,10 +17,10 @@ usage(){
echo "Usage: $0 <path-to-starship-binary> <path-to-dist-directory>"
}
script_dir="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
source "$script_dir/common.sh"
cleanup_server(){
cleanup_server() {
if [[ -n "${server_pid-}" ]]; then
echo "Killing HTTP server ($server_pid) to clean up."
kill "$server_pid"
@ -77,7 +77,7 @@ sleep 3
# on MacOS by default, but lucky for us, it does exist on GHActions runners.
# Wget may return nonzero exit codes even if things were mostly fine (e.g. 404 for
# some links on translated pages) so we simply ignore if it has a failure
wget --mirror --convert-links --adjust-extension --page-requisites --no-parent 127.0.0.1:8000 &> wget.log || true
wget --mirror --convert-links --adjust-extension --page-requisites --no-parent 127.0.0.1:8000 &>wget.log || true
mkdir -p "$pkgdir/usr/local/share/doc/"
mv 127.0.0.1:8000 "$pkgdir/usr/local/share/doc/starship"

View File

@ -4,7 +4,7 @@ component_package="$1"
resources="$2"
arch="$3"
usage(){
usage() {
echo "Builds a distribution package for macOS."
echo "Assumes that the following items already exist:"
echo " - A starship component package"
@ -13,7 +13,7 @@ usage(){
echo " where arch is one of \"arm64\" or \"x86_64\""
}
script_dir="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
source "$script_dir/common.sh"
if [[ "$OSTYPE" != 'darwin'* ]]; then
@ -40,8 +40,7 @@ productbuild --synthesize --package starship-component.pkg --product "$archplist
# search for a line that matches our opening tag and insert our desired lines after it
# Solution taken from https://www.theunixschool.com/2012/06/insert-line-before-or-after-pattern.html
while read -r line
do
while read -r line; do
echo "$line"
if echo "$line" | grep -qF '<installer-gui-script '; then
echo '<welcome file="welcome.html" mime-type="text-html" />'
@ -49,10 +48,10 @@ do
echo '<conclusion file="conclusion.html" mime-type="text-html" />'
echo '<background file="icon.png" scaling="proportional" alignment="bottomleft"/>'
fi
done < starship_raw.dist > starship.dist
done <starship_raw.dist >starship.dist
# The above script does not correctly take care of the last line. Apply fixup.
echo '</installer-gui-script>' >> starship.dist
echo '</installer-gui-script>' >>starship.dist
echo "Creating distribution package with following distribution file:"
cat starship.dist

View File

@ -1,17 +1,17 @@
#!/bin/bash
error(){
error() {
echo "[ERROR]: $1"
exit 1
}
starship_version(){
starship_version() {
starship_program_file="$1"
# Check if this is a relative path: if so, prepend './' to it
if [ "$1" = "${1#/}" ]; then
starship_program_file="./$starship_program_file"
fi
if "$starship_program_file" -V 2>&1 > /dev/null; then
if "$starship_program_file" -V 2>&1 >/dev/null; then
"$starship_program_file" -V | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+'
else
# try to get this information from Cargo.toml

View File

@ -138,7 +138,7 @@ attempts, run
xcrun notarytool history --keychain-profile "AC_PASSWORD"
```
Find the `id` of the attempt you wish to view, then run one of these commmands:
Find the `id` of the attempt you wish to view, then run one of these commands:
```
xcrun notarytool info <run-id> --keychain-profile "AC_PASSWORD"