diff --git a/.github/build-nix b/.github/build-nix deleted file mode 100644 index 1a5a64921ba..00000000000 --- a/.github/build-nix +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env nix-shell -#!nix-shell ../nix/mixed.nix -i bash - -echo ✨ System Details -uname -a - -echo ✨ PWD=$PWD - -echo ✨ CC=$CC -echo ✨ CXX=$CXX - -echo ✨ rustup target add $1 -rustup target add $1 - -echo 👷 Cargo Build -cargo build --release --locked --target $1 \ No newline at end of file diff --git a/.github/build-x86_64-apple-darwin b/.github/build-x86_64-apple-darwin deleted file mode 100644 index cd10887e015..00000000000 --- a/.github/build-x86_64-apple-darwin +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env bash - -echo ✨ System Info -sw_vers -echo ✨ System Details -uname -a -echo ✨ LLVM Version -llvm-config --version - -echo ✨ CMAKE_CXX_COMPILER=$CMAKE_CXX_COMPILER -echo ✨ CMAKE_C_COMPILER=$CMAKE_C_COMPILER - -# llvm@11 paths -export CC=/usr/local/opt/llvm@11/bin/clang -export CXX=/usr/local/opt/llvm@11/bin/clang++ - -export PATH="/usr/local/opt/llvm@11/bin:$PATH" -export LDFLAGS="-L/usr/local/opt/llvm@11/lib" -export CPPFLAGS="-I/usr/local/opt/llvm@11/include" - -echo ✨ clang -v -clang -v -echo ✨ clang++ -v -clang++ -v - -echo ✨ LD_LIBRARY_PATH=$LD_LIBRARY_PATH - -echo ✨ CC=$CC -echo ✨ CXX=$CXX -echo ✨ LIBS=$LIBS - -# fix clang path's to bb expectations -sudo mkdir -p /usr/local/opt/llvm/bin/ -sudo ln -s $(which $CC) /usr/local/opt/llvm/bin/clang -sudo ln -s $(which $CXX) /usr/local/opt/llvm/bin/clang++ - -#fix libomp path -sudo mkdir -p /usr/local/lib/ -sudo ln -s /usr/local/Cellar/libomp/15.0.3/lib/libomp.a /usr/local/lib/libomp.a -ls /usr/local/Cellar/libomp/15.0.3/lib - -echo ✨ /usr/local/opt/llvm/bin/clang --version -/usr/local/opt/llvm/bin/clang --version -echo ✨ /usr/local/opt/llvm/bin/clang++ --version -/usr/local/opt/llvm/bin/clang++ --version - -echo ✨ rustup target add matrix target -rustup target add $1 - -echo 👷 Cargo Build -cargo build --release --target $1 \ No newline at end of file diff --git a/.github/workflows/publish-x86_64-apple-darwin.yml b/.github/workflows/publish-x86_64-apple-darwin.yml deleted file mode 100644 index 736aeddf2bc..00000000000 --- a/.github/workflows/publish-x86_64-apple-darwin.yml +++ /dev/null @@ -1,86 +0,0 @@ -name: build-x86_64-apple-darwin - -on: - workflow_dispatch: - schedule: - - cron: "0 2 * * *" # run at 2 AM UTC - push: - tags: - - "v*" - -jobs: - build-mac: - runs-on: macos-latest - strategy: - max-parallel: 1 - matrix: - target: [x86_64-apple-darwin, aarch64-apple-darwin] - - steps: - - name: Checkout - uses: actions/checkout@v1 - - - name: Setup for Apple Silicon - if: matrix.target == 'aarch64-apple-darwin' - run: | - sudo xcode-select -s /Applications/Xcode_13.2.1.app/Contents/Developer/ - echo "SDKROOT=$(xcrun -sdk macosx$(sw_vers -productVersion) --show-sdk-path)" >> $GITHUB_ENV - echo "MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx$(sw_vers -productVersion) --show-sdk-platform-version)" >> $GITHUB_ENV - - - uses: actions/cache@v3 - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - - name: Rust toolchain Install - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - target: ${{ matrix.target }} - default: true - override: true - - - name: Tools and Dependencies Install - run: | - echo ✨ brew config - brew config - echo ✨ brew install pkg-config cmake llvm@11 libomp tree - brew install pkg-config cmake llvm@11 libomp - - - name: Build environment and Compile - run: | - sed -E -i '' 's/^aztec_backend.+}/aztec_backend = { optional = true, git = "https:\/\/github.com\/noir-lang\/aztec_backend\", features = ["wasm-base"], default-features = false }/g' crates/nargo/Cargo.toml - echo 🧪 patched backend = ''$(cat crates/nargo/Cargo.toml | grep aztec_backend)'' - chmod +x ./.github/build-x86_64-apple-darwin - ./.github/build-x86_64-apple-darwin ${{ matrix.target }} - - - name: Package artifacts - run: | - mkdir dist - cp ./target/${{ matrix.target }}/release/nargo ./dist/nargo - mkdir -p ./dist/noir-lang/std - cp noir_stdlib/src/*.nr ./dist/noir-lang/std - 7z a -ttar -so -an ./dist/* | 7z a -si ./nargo-${{ matrix.target }}.tar.gz - - - name: Upload binaries to nightly - uses: svenstaro/upload-release-action@v2 - if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ./nargo-${{ matrix.target }}.tar.gz - asset_name: nargo-${{ matrix.target }}.tar.gz - overwrite: true - tag: nightly - - - name: Upload binaries to Version - uses: svenstaro/upload-release-action@v2 - if: startsWith(github.ref, 'refs/tags/') - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ./nargo-${{ matrix.target }}.tar.gz - asset_name: nargo-${{ matrix.target }}.tar.gz diff --git a/.github/workflows/publish-x86_64-pc-windows-wasm.yml b/.github/workflows/publish-x86_64-pc-windows-wasm.yml deleted file mode 100644 index 7e59ea9e534..00000000000 --- a/.github/workflows/publish-x86_64-pc-windows-wasm.yml +++ /dev/null @@ -1,77 +0,0 @@ -# such target does not exist, name choosen for convention only -name: build-x86_64-pc-windows-wasm -# --- - -on: - workflow_dispatch: - schedule: - - cron: "0 2 * * *" # run at 2 AM UTC - push: - tags: - - "v*" - -jobs: - build-x86_64-pc-windows-msvc: - runs-on: windows-2022 - strategy: - max-parallel: 1 - matrix: - target: [x86_64-pc-windows-msvc] - - steps: - - name: Checkout - uses: actions/checkout@v1 - - - uses: actions/cache@v3 - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - - name: Rust toolchain Install - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - target: ${{ matrix.target }} - default: true - override: true - - - name: Patch backend in crates/nargo/Cargo.toml - run: | - (Get-Content crates/nargo/Cargo.toml) -replace 'aztec_backend = {(.+)}','aztec_backend = { optional = true, git = "https://github.com/noir-lang/aztec_backend", features = ["wasm-base"], default-features = false }' | Out-File -encoding ASCII crates/nargo/Cargo.toml - - - name: Build environment and Compile - run: | - cargo build --release --target ${{ matrix.target }} - - - name: Package artifacts - run: | - mkdir dist - ls target - ls target/release - cp ./target/${{ matrix.target }}/release/nargo.exe ./dist/nargo.exe - mkdir -p ./dist/noir-lang/std - cp noir_stdlib/src/*.nr ./dist/noir-lang/std - 7z a -tzip nargo-${{ matrix.target }}.zip ./dist/* - - - name: Upload binaries to nightly - uses: svenstaro/upload-release-action@v2 - if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ./nargo-${{ matrix.target }}.zip - asset_name: nargo-${{ matrix.target }}.zip - overwrite: true - tag: nightly - - - name: Upload binaries to Version - uses: svenstaro/upload-release-action@v2 - if: startsWith(github.ref, 'refs/tags/') - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ./nargo-${{ matrix.target }}.zip - asset_name: nargo-${{ matrix.target }}.zip diff --git a/.github/workflows/publish-x86_64-unknown-linux-gnu.yml b/.github/workflows/publish-x86_64-unknown-linux-gnu.yml deleted file mode 100644 index 4200de60a4a..00000000000 --- a/.github/workflows/publish-x86_64-unknown-linux-gnu.yml +++ /dev/null @@ -1,75 +0,0 @@ -name: build-x86_64-unknown-linux-gnu -# --- - -on: - workflow_dispatch: - schedule: - - cron: "0 2 * * *" # run at 2 AM UTC - push: - tags: - - "v*" - -jobs: - build-x86_64-unknown-linux-gnu: - runs-on: ubuntu-22.04 - strategy: - max-parallel: 1 - matrix: - target: [x86_64-unknown-linux-gnu] - - steps: - - name: Checkout - uses: actions/checkout@v1 - - - uses: actions/cache@v3 - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - - uses: cachix/install-nix-action@v18 - with: - nix_path: nixpkgs=channel:nixos-22.05 - - - uses: cachix/cachix-action@v11 - with: - name: nargo-cache - # If you chose signing key for write access - signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}" - # If you chose API tokens for write access OR if you have a private cache - authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" - - - name: Build environment and Compile - run: | - chmod +x .github/build-nix - .github/build-nix ${{ matrix.target }} - - - name: Package artifacts - run: | - mkdir dist - cp ./target/${{ matrix.target }}/release/nargo ./dist/nargo - mkdir -p ./dist/noir-lang/std - cp noir_stdlib/src/*.nr ./dist/noir-lang/std - 7z a -ttar -so -an ./dist/* | 7z a -si ./nargo-${{ matrix.target }}.tar.gz - - - name: Upload binaries to nightly - uses: svenstaro/upload-release-action@v2 - if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ./nargo-${{ matrix.target }}.tar.gz - asset_name: nargo-${{ matrix.target }}.tar.gz - overwrite: true - tag: nightly - - - name: Upload binaries to Version - uses: svenstaro/upload-release-action@v2 - if: startsWith(github.ref, 'refs/tags/') - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ./nargo-${{ matrix.target }}.tar.gz - asset_name: nargo-${{ matrix.target }}.tar.gz diff --git a/README.md b/README.md index 7bd143d1334..e07d35b775a 100644 --- a/README.md +++ b/README.md @@ -14,29 +14,29 @@ Once you have read through the documentation, you can also run the examples loca Backends: - - Barretenberg via FFI - - Marlin via arkworks +- Barretenberg via FFI +- Marlin via arkworks Compiler: - - Module System - - For expressions - - Arrays - - Bit Operations - - Binary operations (<, <=, >, >=, +, -, *, /, %) [See documentation for an extensive list] - - Unsigned integers - - If statements - - Structures and Tuples - - Generics +- Module System +- For expressions +- Arrays +- Bit Operations +- Binary operations (<, <=, >, >=, +, -, \*, /, %) [See documentation for an extensive list] +- Unsigned integers +- If statements +- Structures and Tuples +- Generics ACIR Supported OPCODES: - - Sha256 - - Blake2s - - Schnorr signature verification - - MerkleMembership - - Pedersen - - HashToField +- Sha256 +- Blake2s +- Schnorr signature verification +- MerkleMembership +- Pedersen +- HashToField ## Future Work @@ -53,6 +53,14 @@ Concretely the following items are on the road map: - Recursion - Big integers +## Nargo CLI - pre-built + +`nargo` - command line interface tool for interacting with Noir programs - allows compiling, proving, verifying, and more. Nightly binary builds can be found [here](https://github.com/noir-lang/noir/releases/tag/nightly). Please refer [noir-lang/build-nargo](https://github.com/noir-lang/build-nargo) to inspect how these are built for various platforms. + +## Nargo CLI - install scripts + +[noir-lang/noirup](https://github.com/noir-lang/noirup) repository contains install scripts for Linux, macOS, and Windows systems to allow easy installation. + ## License Noir is free and open source. It is distributed under a dual license. (MIT/APACHE) diff --git a/nix/mixed.nix b/nix/mixed.nix deleted file mode 100644 index b797616505d..00000000000 --- a/nix/mixed.nix +++ /dev/null @@ -1,38 +0,0 @@ -{ pkgs ? import {} }: - -pkgs.mkShell { - nativeBuildInputs = with pkgs; [ - which - git - pkg-config - cmake - ]; - - buildInputs = with pkgs; [ - llvmPackages.openmp - openssl - rustup - ]; - - LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [ - pkgs.llvmPackages.openmp - pkgs.openssl - ]; - - shellHook = '' - echo 🧪 NIX_CFLAGS_COMPILE=$NIX_CFLAGS_COMPILE - echo 🧪 NIX_LDFLAGS=$NIX_LDFLAGS - echo 🧪 LD_LIBRARY_PATH=$LD_LIBRARY_PATH - echo 🧪 CPATH=$CPATH - echo 🧪 $CC $AR $CXX $LD - echo 🧪 $(which $CC) - echo 🧪 $(which $AR) - echo 🧪 $(which $CXX) - echo 🧪 $(which $LD) - echo 🧪 $(which pkg-config) - echo 🧪 pkg-config --list-all ↩️ - pkg-config --list-all - echo ⌛ - ''; - -} diff --git a/noirup/README.md b/noirup/README.md deleted file mode 100644 index 3f2da64f692..00000000000 --- a/noirup/README.md +++ /dev/null @@ -1,67 +0,0 @@ -# `noirup` - -Update or revert to a specific Nargo branch with ease. - -## Installing - -```sh -curl -L https://raw.githubusercontent.com/noir-lang/noir/master/noirup/install | bash -``` - -## Usage - -To install the **nightly** version: - -```sh -noirup -``` - -To install a specific **version** (in this case the `nightly` version): - -```sh -noirup --version nightly -``` - -To install a specific **branch** (in this case the `release/0.1.0` branch's latest commit): - -```sh -noirup --branch release/0.1.0 -``` - -To install a **fork's main branch** (in this case `tomafrench/noir`'s main branch): - -```sh -noirup --repo tomafrench/noir -``` - -To install a **specific branch in a fork** (in this case the `patch-10` branch's latest commit in `tomafrench/noir`): - -```sh -noirup --repo tomafrench/noir --branch patch-10 -``` - -To install from a **specific Pull Request**: - -```sh -noirup --pr 367 -``` - -To install from a **specific commit**: - -```sh -noirup -C 20048e7 -``` - -To install a local directory or repository (e.g. one located at `~/git/noir`, assuming you're in the home directory) - -##### Note: --branch, --repo, and --version flags are ignored during local installations. - -```sh -noirup --path ./git/noir -``` - ---- - -**Tip**: All flags have a single character shorthand equivalent! You can use `-v` instead of `--version`, etc. - ---- diff --git a/noirup/install b/noirup/install deleted file mode 100644 index f383df57fc9..00000000000 --- a/noirup/install +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env bash -set -e - -echo Installing noirup... - -NARGO_DIR=${NARGO_DIR-"$HOME/.nargo"} -NARGO_BIN_DIR="$NARGO_DIR/bin" - -BIN_URL="https://raw.githubusercontent.com/noir-lang/noir/master/noirup/noirup" -BIN_PATH="$NARGO_BIN_DIR/noirup" - -# Create the .nargo bin directory and noirup binary if it doesn't exist. -mkdir -p $NARGO_BIN_DIR -curl -# -L $BIN_URL -o $BIN_PATH -chmod +x $BIN_PATH - -# Store the correct profile file (i.e. .profile for bash or .zshrc for ZSH). -case $SHELL in -*/zsh) - PROFILE=$HOME/.zshrc - PREF_SHELL=zsh - ;; -*/bash) - PROFILE=$HOME/.bashrc - PREF_SHELL=bash - ;; -*/fish) - PROFILE=$HOME/.config/fish/config.fish - PREF_SHELL=fish - ;; -*/ash) - PROFILE=$HOME/.profile - PREF_SHELL=ash - ;; -*) - echo "noirup: could not detect shell, manually add ${NARGO_BIN_DIR} to your PATH." - exit 1 - ;; -esac - -# Only add noirup if it isn't already in PATH. -if [[ ":$PATH:" != *":${NARGO_BIN_DIR}:"* ]]; then - # Add the noirup directory to the path and ensure the old PATH variables remain. - echo >>$PROFILE && echo "export PATH=\"\$PATH:$NARGO_BIN_DIR\"" >>$PROFILE -fi - -echo && echo "Detected your preferred shell is ${PREF_SHELL} and added noirup to PATH. Run 'source ${PROFILE}' or start a new terminal session to use noirup." -echo "Then, simply run 'noirup' to install Nargo." diff --git a/noirup/noirup b/noirup/noirup deleted file mode 100644 index 2c36a7d74a6..00000000000 --- a/noirup/noirup +++ /dev/null @@ -1,200 +0,0 @@ -#!/usr/bin/env bash -set -e - -NARGO_DIR=${NARGO_DIR-"$HOME/.nargo"} -NARGO_BIN_DIR="$NARGO_DIR/bin" -CONFIG_DIR=${XDG_CONFIG_HOME-"$HOME/.config"} - -main() { - need_cmd git - need_cmd curl - - while [[ $1 ]]; do - case $1 in - --) shift; break;; - - -r|--repo) shift; NOIRUP_REPO=$1;; - -b|--branch) shift; NOIRUP_BRANCH=$1;; - -v|--version) shift; NOIRUP_VERSION=$1;; - -p|--path) shift; NOIRUP_LOCAL_REPO=$1;; - -P|--pr) shift; NOIRUP_PR=$1;; - -C|--commit) shift; NOIRUP_COMMIT=$1;; - -h|--help) - usage - exit 0 - ;; - *) - err "internal error: unknown option "$1"\n";; - esac; shift - done - - if [ -n "$NOIRUP_PR" ]; then - if [ -z "$NOIRUP_BRANCH" ]; then - NOIRUP_BRANCH="refs/pull/$NOIRUP_PR/head" - else - err "can't use --pr and --branch at the same time" - fi - fi - - # Installs nargo from a local repository if --path parameter is provided - if [[ -n "$NOIRUP_LOCAL_REPO" ]]; then - need_cmd cargo - - # Ignore branches/versions as we do not want to modify local git state - if [ -n "$NOIRUP_REPO" ] || [ -n "$NOIRUP_BRANCH" ] || [ -n "$NOIRUP_VERSION" ]; then - warn "--branch, --version, and --repo arguments are ignored during local install" - fi - - # Enter local repo and build - say "installing from $NOIRUP_LOCAL_REPO" - cd $NOIRUP_LOCAL_REPO - RUSTFLAGS="-C target-cpu=native" ensure cargo build --release # need 4 speed - - # Remove prior installations if they exist - rm -f "$NARGO_BIN_DIR/nargo" - - # Symlink from local repo binaries to bin dir - ensure ln -s "$PWD/target/release/nargo" "$NARGO_BIN_DIR/nargo" - - say "done" - exit 0 - fi - - NOIRUP_REPO=${NOIRUP_REPO-noir-lang/noir} - if [[ "$NOIRUP_REPO" == "noir-lang/noir" && -z "$NOIRUP_BRANCH" && -z "$NOIRUP_COMMIT" ]]; then - NOIRUP_VERSION=${NOIRUP_VERSION-nightly} - NOIRUP_TAG=$NOIRUP_VERSION - - # Normalize versions (handle channels, versions without v prefix) - if [[ "$NOIRUP_VERSION" == [[:digit:]]* ]]; then - # Add v prefix - NOIRUP_VERSION="v${NOIRUP_VERSION}" - NOIRUP_TAG="${NOIRUP_VERSION}" - fi - - say "installing nargo (version ${NOIRUP_VERSION}, tag ${NOIRUP_TAG})" - - PLATFORM="$(uname -s)" - case $PLATFORM in - Linux) - PLATFORM="unknown-linux-gnu" - ;; - Darwin) - PLATFORM="apple-darwin" - ;; - *) - err "unsupported platform: $PLATFORM" - ;; - esac - - # We currently only provide binaries targetting x64_64 architectures. - - ARCHITECTURE="x86_64" - # ARCHITECTURE="$(uname -m)" - # if [ "${ARCHITECTURE}" = "x86_64" ]; then - # # Redirect stderr to /dev/null to avoid printing errors if non Rosetta. - # if [ "$(sysctl -n sysctl.proc_translated 2>/dev/null)" = "1" ]; then - # ARCHITECTURE="arm64" # Rosetta. - # else - # ARCHITECTURE="amd64" # Intel. - # fi - # elif [ "${ARCHITECTURE}" = "arm64" ] ||[ "${ARCHITECTURE}" = "aarch64" ] ; then - # ARCHITECTURE="arm64" # Arm. - # else - # ARCHITECTURE="amd64" # Amd. - # fi - - # Compute the URL of the release tarball in the Noir repository. - RELEASE_URL="https://github.com/${NOIRUP_REPO}/releases/download/${NOIRUP_TAG}" - BIN_TARBALL_URL="${RELEASE_URL}/nargo-${ARCHITECTURE}-${PLATFORM}.tar.gz" - - # Download the binaries tarball and unpack it into the .nargo bin directory. - say "downloading latest nargo" - ensure curl -# -L $BIN_TARBALL_URL | tar -xzC $NARGO_BIN_DIR - - # Replace existing std_lib with copy from new installation. - ensure rm -rf "$CONFIG_DIR/noir-lang/std" - ensure mv "$NARGO_BIN_DIR/noir-lang" $CONFIG_DIR - - else - need_cmd cargo - NOIRUP_BRANCH=${NOIRUP_BRANCH-master} - REPO_PATH="${NARGO_DIR}/${NOIRUP_REPO}" - - if [ ! -d $REPO_PATH ]; then - # Repo path did not exist, grab the author from the repo, make a directory in .nargo, cd to it and clone. - IFS="/" read -ra AUTHOR <<<"$NOIRUP_REPO" - ensure mkdir -p "$NARGO_DIR/$AUTHOR" - cd "$NARGO_DIR/$AUTHOR" - ensure git clone https://github.com/${NOIRUP_REPO} - fi - # force checkout, discarding any local changes - cd $REPO_PATH - ensure git fetch origin ${NOIRUP_BRANCH}:remotes/origin/${NOIRUP_BRANCH} - ensure git checkout origin/${NOIRUP_BRANCH} - # If set, checkout specific commit from branch - if [ ! -z $NOIRUP_COMMIT ]; then - say "installing at commit ${NOIRUP_COMMIT}" - ensure git checkout ${NOIRUP_COMMIT} - fi - # Build the repo and install it locally to the .nargo bin directory. - # --root appends /bin to the directory it is given, so we pass NARGO_DIR. - RUSTFLAGS="-C target-cpu=native" ensure cargo install --path ./crates/nargo --bins --locked --force --root $NARGO_DIR - - fi - - if [[ $(which nargo) =~ "cargo" ]]; then - warn "it appears your system has already has nargo installed via cargo. you may need to run 'rm $(which nargo)' to allow noirup to take precedence!" - fi - - say "done" -} - -usage() { - cat 1>&2 < -OPTIONS: - -h, --help Print help information - -v, --version Install a specific version - -b, --branch Install a specific branch - -P, --pr Install a specific Pull Request - -C, --commit Install a specific commit - -r, --repo Install from a remote GitHub repo (uses default branch if no other options are set) - -p, --path Install a local repository -EOF -} - -say() { - printf 'noirup: %s\n' "$1" -} - -warn() { - say "warning: ${1}" >&2 -} - -err() { - say "$1" >&2 - exit 1 -} - -need_cmd() { - if ! check_cmd "$1"; then - err "need '$1' (command not found)" - fi -} - -check_cmd() { - command -v "$1" >/dev/null 2>&1 -} - -# Run a command that should never fail. If the command fails execution -# will immediately terminate with an error showing the failing -# command. -ensure() { - if ! "$@"; then err "command failed: $*"; fi -} - -main "$@" || exit 1