Skip to content

Commit 11a1994

Browse files
committed
printf for consistency
1 parent b0865f4 commit 11a1994

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

scripts/getting-started.sh

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ prompt() {
1010
[Yy]* ) return 0;; # Yes, return 0 (true)
1111
[Nn]* ) return 1;; # No, return 1 (false)
1212
"" ) return 1;; # Default to no if user just presses Enter
13-
* ) echo "Please answer yes or no.";;
13+
* ) printf "Please answer yes or no.\n";;
1414
esac
1515
done
1616
}
@@ -23,7 +23,7 @@ prompt_default_yes() {
2323
[Yy]* ) return 0;; # Yes, return 0 (true)
2424
[Nn]* ) return 1;; # No, return 1 (false)
2525
"" ) return 0;; # Default to yes if user just presses Enter
26-
* ) echo "Please answer yes or no.";;
26+
* ) printf "Please answer yes or no.\n";;
2727
esac
2828
done
2929
}
@@ -56,17 +56,17 @@ EOF
5656
# Determine OS
5757
os_name=$(uname -s)
5858
if [ "$os_name" = "Darwin" ]; then
59-
echo "🍎 Detected macOS. Installing dependencies via Homebrew."
59+
printf "🍎 Detected macOS. Installing dependencies via Homebrew.\n"
6060

6161
# Check if brew is installed
6262
if command -v brew >/dev/null 2>&1; then
6363
printf "\n✅︎🍺 Homebrew already installed.\n"
6464
else
6565
if prompt_default_yes "\n🍺 Homebrew is not installed. Install it?\n"; then
66-
echo "🍺 Installing Homebrew."
66+
printf "🍺 Installing Homebrew.\n"
6767
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
6868
else
69-
echo "❌ Cannot continue without homebrew. Aborting."
69+
printf "❌ Cannot continue without homebrew. Aborting.\n"
7070
exit 1
7171
fi
7272
fi
@@ -78,15 +78,15 @@ if [ "$os_name" = "Darwin" ]; then
7878
if prompt_default_yes "\n🍺 git seems to be missing but we will need it; install git?\n"; then
7979
brew install git
8080
else
81-
echo "❌ Cannot continue without git. Aborting."
81+
printf "❌ Cannot continue without git. Aborting.\n"
8282
exit 1
8383
fi
8484
fi
8585

8686
if prompt "\n🍺 Install cmake, openssl and protobuf?"; then
8787
brew install cmake openssl protobuf
8888
else
89-
echo "🍺 Assuming cmake, openssl and protobuf are present."
89+
printf "🍺 Assuming cmake, openssl and protobuf are present.\n"
9090
fi
9191
elif [ "$os_name" = "Linux" ]; then
9292
# find the distro name in the release files
@@ -118,7 +118,7 @@ elif [ "$os_name" = "Linux" ]; then
118118
fi
119119
fi
120120
else
121-
echo "❌ Unknown operating system. Aborting."
121+
printf "❌ Unknown operating system. Aborting.\n"
122122
exit 1
123123
fi
124124

@@ -128,47 +128,47 @@ if command -v rustc >/dev/null 2>&1; then
128128
printf "\n✅︎🦀 Rust already installed.\n"
129129
else
130130
if prompt_default_yes "\n🦀 Rust is not installed. Install it?"; then
131-
echo "🦀 Installing via rustup."
131+
printf "🦀 Installing via rustup.\n"
132132
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
133133
. "$HOME/.cargo/env"
134134
else
135-
echo "Aborting."
135+
printf "Aborting.\n"
136136
exit 1
137137
fi
138138
fi
139139

140140
# Ensure that we have wasm support
141141
if prompt_default_yes "\n🦀 Setup the Rust environment (e.g. WASM support)?"; then
142-
echo "🦀 Setting up Rust environment."
142+
printf "🦀 Setting up Rust environment.\n"
143143
rustup default stable
144144
rustup update
145145
rustup target add wasm32-unknown-unknown
146146
rustup component add rust-src
147147
fi
148148

149149
if ! prompt "\nWould you like to start with one of the templates?"; then
150-
echo "⚡ All done, the environment is ready for hacking."
150+
printf "⚡ All done, the environment is ready for hacking.\n"
151151
exit 0
152152
fi
153153

154154
while true; do
155155
printf "\nWhich template would you like to start with?\n"
156-
echo "1) minimal template"
157-
echo "2) parachain template"
158-
echo "3) solochain template"
159-
echo "q) cancel"
156+
printf "1) minimal template\n"
157+
printf "2) parachain template\n"
158+
printf "3) solochain template\n"
159+
printf "q) cancel"
160160
read -p "#? " template
161161
case $template in
162162
[1]* ) clone_and_enter_template minimal; break;;
163163
[2]* ) clone_and_enter_template parachain; break;;
164164
[3]* ) clone_and_enter_template solochain; break;;
165-
[qQ]* ) echo "Canceling, not using a template."; exit 0;;
166-
* ) echo "Selection not recognized.";;
165+
[qQ]* ) printf "Canceling, not using a template.\n"; exit 0;;
166+
* ) printf "Selection not recognized.\n";;
167167
esac
168168
done
169169

170170
if ! prompt_default_yes "\n⚙️ Let's compile the node? It might take a while."; then
171-
echo "⚡ Script finished, you can continue in the ${template}-template directory."
171+
printf "⚡ Script finished, you can continue in the ${template}-template directory.\n"
172172
exit 0
173173
fi
174174

0 commit comments

Comments
 (0)