Skip to content

Commit 41c6653

Browse files
authored
chore: add version number to foundryup (#9681)
* add version number, display using --version * use say instead of echo * add input box for foundryup version to bug template
1 parent ff2c564 commit 41c6653

File tree

2 files changed

+35
-19
lines changed

2 files changed

+35
-19
lines changed

.github/ISSUE_TEMPLATE/BUG-FORM.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ body:
3232
attributes:
3333
label: What version of Foundry are you on?
3434
placeholder: "Run forge --version and paste the output here"
35+
- type: input
36+
attributes:
37+
label: What version of Foundryup are you on?
38+
placeholder: "Run foundryup --version and paste the output here"
3539
- type: input
3640
attributes:
3741
label: What command(s) is the bug in?
@@ -51,4 +55,4 @@ body:
5155
label: Describe the bug
5256
description: Please include relevant Solidity snippets as well if relevant.
5357
validations:
54-
required: true
58+
required: true

foundryup/foundryup

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
#!/usr/bin/env bash
22
set -eo pipefail
33

4+
# NOTE: if you make modifications to this script, please increment the version number.
5+
# Major / minor: incremented for each stable release of Foundry.
6+
# Patch: incremented for each change between stable releases.
7+
FOUNDRYUP_INSTALLER_VERSION="0.3.0"
8+
49
BASE_DIR=${XDG_CONFIG_HOME:-$HOME}
510
FOUNDRY_DIR=${FOUNDRY_DIR:-"$BASE_DIR/.foundry"}
611
FOUNDRY_VERSIONS_DIR="$FOUNDRY_DIR/versions"
@@ -23,6 +28,8 @@ main() {
2328
case $1 in
2429
--) shift; break;;
2530

31+
-v|--version) shift; version;;
32+
-U|--update) shift; update;;
2633
-r|--repo) shift; FOUNDRYUP_REPO=$1;;
2734
-b|--branch) shift; FOUNDRYUP_BRANCH=$1;;
2835
-i|--install) shift; FOUNDRYUP_VERSION=$1;;
@@ -32,7 +39,6 @@ main() {
3239
-P|--pr) shift; FOUNDRYUP_PR=$1;;
3340
-C|--commit) shift; FOUNDRYUP_COMMIT=$1;;
3441
-j|--jobs) shift; FOUNDRYUP_JOBS=$1;;
35-
-U|--update) shift; update;;
3642
--arch) shift; FOUNDRYUP_ARCH=$1;;
3743
--platform) shift; FOUNDRYUP_PLATFORM=$1;;
3844
-h|--help)
@@ -71,7 +77,7 @@ main() {
7177

7278
# Ignore branches/versions as we do not want to modify local git state
7379
if [ -n "$FOUNDRYUP_REPO" ] || [ -n "$FOUNDRYUP_BRANCH" ] || [ -n "$FOUNDRYUP_VERSION" ]; then
74-
warn "--branch, --version, and --repo arguments are ignored during local install"
80+
warn "--branch, --install, --use, and --repo arguments are ignored during local install"
7581
fi
7682

7783
# Enter local repo and build
@@ -256,6 +262,8 @@ USAGE:
256262
257263
OPTIONS:
258264
-h, --help Print help information
265+
-v, --version Print the version of foundryup
266+
-U, --update Update foundryup to the latest version
259267
-i, --install Install a specific version from built binaries
260268
-l, --list List versions installed from built binaries
261269
-u, --use Use a specific installed version from built binaries
@@ -265,12 +273,31 @@ OPTIONS:
265273
-r, --repo Build and install from a remote GitHub repo (uses default branch if no other options are set)
266274
-p, --path Build and install a local repository
267275
-j, --jobs Number of CPUs to use for building Foundry (default: all CPUs)
268-
-U, --update Update foundryup to the latest version
269276
--arch Install a specific architecture (supports amd64 and arm64)
270277
--platform Install a specific platform (supports win32, linux, and darwin)
271278
EOF
272279
}
273280

281+
version() {
282+
say "$FOUNDRYUP_INSTALLER_VERSION"
283+
exit 0
284+
}
285+
286+
update() {
287+
say "updating foundryup..."
288+
289+
# Download to a temporary file first
290+
tmp_file="$(mktemp)"
291+
ensure download "$FOUNDRY_BIN_URL" "$tmp_file"
292+
293+
# Replace the current foundryup with the downloaded file
294+
ensure mv "$tmp_file" "$FOUNDRY_BIN_PATH"
295+
ensure chmod +x "$FOUNDRY_BIN_PATH"
296+
297+
say "successfully updated foundryup"
298+
exit 0
299+
}
300+
274301
list() {
275302
if [ -d "$FOUNDRY_VERSIONS_DIR" ]; then
276303
for VERSION in $FOUNDRY_VERSIONS_DIR/*; do
@@ -309,21 +336,6 @@ use() {
309336
fi
310337
}
311338

312-
update() {
313-
say "updating foundryup..."
314-
315-
# Download to a temporary file first
316-
tmp_file="$(mktemp)"
317-
ensure download "$FOUNDRY_BIN_URL" "$tmp_file"
318-
319-
# Replace the current foundryup with the downloaded file
320-
ensure mv "$tmp_file" "$FOUNDRY_BIN_PATH"
321-
ensure chmod +x "$FOUNDRY_BIN_PATH"
322-
323-
say "successfully updated foundryup"
324-
exit 0
325-
}
326-
327339
say() {
328340
printf "foundryup: %s\n" "$1"
329341
}

0 commit comments

Comments
 (0)