diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..792086d --- /dev/null +++ b/.envrc @@ -0,0 +1,9 @@ +# Watch flake.nix for changes. +watch_file flake.nix + +# Disable builders for trivial flake actions, such as direnv reload. +# Helps us reduce overhead introduced by a redundant network request. +if ! NIX_CONFIG="builders =" use flake . ; then + echo "Default shell could not be loaded." >&2 + return 1 +fi diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 64625dd..28e123e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,93 +1,64 @@ name: Release on: - push: - branches: - - main - tags: - - 'v*' - pull_request: - branches: [ '**' ] - workflow_dispatch: + push: + branches: + - main + tags: + - "v*" + pull_request: + branches: ["**"] + workflow_dispatch: concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true permissions: - contents: write + contents: write jobs: - quality-and-release: - name: Quality & Release - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 + quality-and-release: + name: Quality & Release + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 - - name: Setup Go - uses: actions/setup-go@v5 - with: - go-version: '1.24' - cache: true - - - name: Tidy - run: go mod tidy + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: "1.24" + cache: true - - name: Run Linter - uses: golangci/golangci-lint-action@v8 - with: - version: v2.11.4 + - name: Tidy + run: go mod tidy - - name: Run Tests - run: go test -v ./... + - name: Run Linter + uses: golangci/golangci-lint-action@v8 + with: + version: v2.11.4 - - name: Build Binaries - if: startsWith(github.ref, 'refs/tags/v') - run: | - mkdir -p dist - platforms=("linux/amd64" "linux/arm64" "darwin/amd64" "darwin/arm64") - for platform in "${platforms[@]}"; do - os_arch=(${platform//\// }) - GOOS=${os_arch[0]} - GOARCH=${os_arch[1]} - output_name="iris" - [ "$GOOS" == "windows" ] && output_name="iris.exe" - - echo "Building $GOOS/$GOARCH..." - GOOS=$GOOS GOARCH=$GOARCH go build \ - -ldflags="-s -w -X github.com/versenilvis/iris/root.Version=${{ github.ref_name }}" \ - -trimpath -o "dist/$output_name" ./cmd/iris - - cd dist - tar -czf "iris_${GOOS}_${GOARCH}.tar.gz" "$output_name" - rm "$output_name" - cd .. - done + - name: Run Tests + run: go test -v ./... - - name: Prepare Release Notes - if: startsWith(github.ref, 'refs/tags/v') - run: | - # Generate standard GitHub release notes - GEN_NOTES=$(gh api repos/${{ github.repository }}/releases/generate-notes -f tag_name=${{ github.ref_name }} --jq .body) - cat < release_notes.md - $GEN_NOTES + - name: Create vendor tarball + if: startsWith(github.ref, 'refs/tags/v') + run: | + go mod vendor + tar -czf iris-${GITHUB_REF_NAME#v}-vendor.tar.gz vendor/ + sha256sum iris-${GITHUB_REF_NAME#v}-vendor.tar.gz > iris-${GITHUB_REF_NAME#v}-vendor.tar.gz.sha256 - ## Update - \`\`\`bash - iris update - \`\`\` - EOF - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Create GitHub Release - if: startsWith(github.ref, 'refs/tags/v') - uses: softprops/action-gh-release@v1 - with: - name: ${{ github.ref_name }} - body_path: release_notes.md - files: dist/*.tar.gz - generate_release_notes: false - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Run GoReleaser + if: startsWith(github.ref, 'refs/tags/v') + uses: goreleaser/goreleaser-action@v6 + with: + distribution: goreleaser + version: latest + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + AUR_KEY: ${{ secrets.AUR_SSH_PRIVATE_KEY }} + HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 31f1331..2e8c4b8 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,6 @@ docs/code docs/plan todo.txt scratch/ +.env +.byte/ +dist/ \ No newline at end of file diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..328fd6e --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,92 @@ +version: 2 + +project_name: iris + +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - darwin + goarch: + - amd64 + - arm64 + ldflags: + - -s -w -X github.com/versenilvis/iris/root.Version={{.Version}} + flags: + - -trimpath + main: ./cmd/iris + binary: iris + +archives: + - format: tar.gz + name_template: >- + {{ .ProjectName }}_{{ .Os }}_{{ .Arch }} + +checksum: + name_template: "checksums.txt" + algorithm: sha256 + +release: + extra_files: + - glob: ./iris-*-vendor.tar.gz + - glob: ./iris-*-vendor.tar.gz.sha256 + footer: | + ## Update + ```bash + iris update + ``` +# AUR +aurs: + - name: iris-bin + package: |- + install -Dm755 "./iris" "${pkgdir}/usr/bin/iris" + install: "scripts/aur.install" + homepage: "https://github.com/versenilvis/iris" + description: "A highly customizable, blazing fast and context-aware CLI autocomplete/navigation tool" + maintainers: + - "VERSE " + license: "MIT" + private_key: "{{ .Env.AUR_KEY }}" + git_url: "ssh://aur@aur.archlinux.org/iris.git" + commit_author: + name: "goreleaserbot" + email: "bot@goreleaser.com" + commit_msg_template: "AUR release {{ .Tag }}" + provides: + - iris + conflicts: + - iris-bin +# Homebrew +brews: + - repository: + owner: versenilvis + name: homebrew-iris + token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}" + directory: Formula + homepage: "https://github.com/versenilvis/iris" + description: "A highly customizable, blazing fast and context-aware CLI autocomplete/navigation tool" + license: "MIT" + caveats: | + To completely remove IRIS configurations and shell hooks, + please run 'iris uninstall' BEFORE removing this package, or manually + clean up ~/.config/iris and your shell RC files (e.g. ~/.zshrc). + test: | + system "#{bin}/iris", "--help" + +# Debian/RPM +nfpms: + - id: iris + package_name: iris + vendor: "versenilvis" + homepage: "https://github.com/versenilvis/iris" + maintainer: "VERSE " + description: "A highly customizable, blazing fast and context-aware CLI autocomplete/navigation tool" + license: "MIT" + file_name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}" + scripts: + prerm: "scripts/prerm.sh" + formats: + - deb + - rpm + bindir: /usr/bin diff --git a/README.md b/README.md index b543796..9eb9502 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,13 @@ logo - +

IRIS (Intelligent Real-time Input Suggestion) - A shell auto-completion tool that works like code editor's IntelliSense

- - [![macOS](https://img.shields.io/badge/macOS-FFFFFF?style=for-the-badge&logo=apple&logoColor=black)](https://www.apple.com/macos/) - [![Linux](https://img.shields.io/badge/Linux-131415?style=for-the-badge&logo=linux&logoColor=white)](https://www.kernel.org/) -
+ +[![macOS](https://img.shields.io/badge/macOS-FFFFFF?style=for-the-badge&logo=apple&logoColor=black)](https://www.apple.com/macos/) +[![Linux](https://img.shields.io/badge/Linux-131415?style=for-the-badge&logo=linux&logoColor=white)](https://www.kernel.org/) +
[![Status](https://img.shields.io/badge/status-beta-yellow?style=for-the-badge&logo=github&logoColor=white)]() [![License: 0BSD](https://img.shields.io/badge/License-0BSD-blue?style=for-the-badge&logo=github&logoColor=white)](./LICENSE) @@ -38,6 +38,7 @@ Run iris wherever you already work; your local machine, a remote server, or anyw --> ## AI suggestions +
output IRIS has AI suggestions like your code editor (API key/Local) @@ -46,7 +47,7 @@ Run iris wherever you already work; your local machine, a remote server, or anyw ## Why IRIS instead of Fig > [!IMPORTANT] -> **[Fig](https://app.fig.io/) was officially sunset in September 2024 and migrated to Amazon Q Developer (which requires cloud authentication and proprietary bloat)** +> **[Fig](https://app.fig.io/) was officially sunset in September 2024 and migrated to Amazon Q Developer (which requires cloud authentication and proprietary bloat)** > **IRIS is the lightweight, open-source, zero-telemetry alternative built purely on native Go and TTY with no accounts, no GUI app, and no background daemons required** ### How it compares @@ -83,20 +84,135 @@ Shell plugins are great, but they also come with trade-offs. And also, not every - Terminal emulator with ANSI color support - Go 1.24 or newer (if building from source) +> [!WARNING] +> Currently, Windows is not supported -#### Method 1: Install script (recommended) +#### Method 1: Package managers + +
+Arch Linux (AUR) +
+ +IRIS is available on the Arch User Repository. You can install it using your favorite AUR helper: + +```bash +yay -S iris-bin +``` +
+ +
+macOS / Linux (Homebrew) +
+ +Install IRIS via Homebrew tap: + +```bash +brew install versenilvis/iris/iris +``` +
+ +
+Nix Flakes +
+ +If you are using Nix Flakes, you can consume this module directly without building it manually. + +1. In your `flake.nix` inputs, add: + + ```nix + iris.url = "github:versenilvis/iris/main"; + ``` + +2. Then, use one of the following options to add IRIS to your system: + + **Option A: Try without installing (ephemeral)** + ```bash + nix run github:versenilvis/iris + ``` + + **Option B: Install to your user profile** + ```bash + nix profile install github:versenilvis/iris + ``` + + **Option C: Using Home Manager** + *(Ensure you pass `inputs` to modules via `extraSpecialArgs`)* + ```nix + home.packages = [ inputs.iris.packages.${pkgs.system}.default ]; + ``` + + **Option D: Without Home Manager (NixOS System)** + *(Ensure you pass `inputs` to modules via `specialArgs`)* + ```nix + environment.systemPackages = [ inputs.iris.packages.${pkgs.system}.default ]; + ``` +
+ +
+Debian / Ubuntu (.deb) +
+ +```bash +curl -sLO https://github.com/versenilvis/iris/releases/latest/download/iris_linux_amd64.deb +sudo dpkg -i iris_linux_amd64.deb +rm iris_linux_amd64.deb +``` +*(For ARM64 architecture, replace `amd64` with `arm64`)* +
+ +
+Fedora / RHEL (.rpm) +
+ +```bash +curl -sLO https://github.com/versenilvis/iris/releases/latest/download/iris_linux_amd64.rpm +sudo rpm -i iris_linux_amd64.rpm +rm iris_linux_amd64.rpm +``` +*(For ARM64 architecture, replace `amd64` with `arm64`)* +
+ +
+Aqua +
+ +If you use [aqua](https://aquaproj.github.io/), you can install IRIS by adding it to your `aqua.yaml`: + +```yaml +packages: + - name: versenilvis/iris +``` + +Then run `aqua i`. +
+ +
+asdf +
+ +If you use [asdf](https://asdf-vm.com/), you can install IRIS via its plugin: + +```bash +asdf plugin add iris https://github.com/versenilvis/asdf-iris.git +asdf install iris latest +asdf set -u iris latest +asdf current iris +``` +
+ +#### Method 2: Install script (recommended) ```bash curl -sSL https://raw.githubusercontent.com/versenilvis/iris/main/scripts/install.sh | sh ``` -#### Method 2: Go install +#### Method 3: Go install ```bash go install github.com/versenilvis/iris/cmd/iris@latest ``` -#### Method 3: Build from source (for developers) +#### Method 4: Build from source (for developers) ```bash git clone https://github.com/versenilvis/iris.git @@ -104,9 +220,6 @@ cd iris just reload ``` -> [!WARNING] -> Currently, Windows is not supported - ## Uninstall To completely uninstall IRIS, remove all configurations, and clean up your shell integration files, simply run: @@ -224,18 +337,19 @@ timeout_ms = 5000 | ↓ | Navigate down / history | Move the selection down, or open command history when the prompt is empty.| | → | Accept ghost text | Accept the faded ghost text suggestion when the menu is open. | | ← / → | Move cursor | Move the cursor inside the input buffer. Disabled when the prompt is empty| -| Ctrl + R | Switch mode | Toggle between `spec` and `history` mode. | -| Ctrl + A | Beginning of line | Move the cursor to the start of the command line. | -| Ctrl + E | End of line | Move the cursor to the end of the command line. | -| Ctrl + L | Clear screen | Clear the terminal while preserving the input buffer and redrawing the menu. | -| Ctrl + U | Clear command | Remove the entire current command and close the menu. | -| Ctrl + C | Cancel command | Send `SIGINT`, clear the input buffer, and close the menu. | -| Ctrl + W | Delete word | Delete the word immediately before the cursor. | +| Ctrl/⌘ + R | Switch mode | Toggle between `spec` and `history` mode. | +| Ctrl/⌘ + A | Beginning of line | Move the cursor to the start of the command line. | +| Ctrl/⌘ + E | End of line | Move the cursor to the end of the command line. | +| Ctrl/⌘ + L | Clear screen | Clear the terminal while preserving the input buffer and redrawing the menu. | +| Ctrl/⌘ + U | Clear command | Remove the entire current command and close the menu. | +| Ctrl/⌘ + C | Cancel command | Send `SIGINT`, clear the input buffer, and close the menu. | +| Ctrl/⌘ + W | Delete word | Delete the word immediately before the cursor. | > [!NOTE] -> With Ctrl + A, Ctrl + E, Ctrl + W, Ctrl + U, Ctrl + L, and Ctrl + C: they belong to your shell by default. IRIS handles them directly in raw mode so your cursor and menu stay in sync +> With Ctrl/⌘ + A, Ctrl/⌘ + E, Ctrl/⌘ + W, Ctrl/⌘ + U, Ctrl/⌘ + L, and Ctrl/⌘ + C: they belong to your shell by default. IRIS handles them directly in raw mode so your cursor and menu stay in sync ## Theme +
Kitty terminal showcase 😺 Kitty terminal @@ -300,6 +414,7 @@ Thank you! I'd love to hear your feedback Feel free to reach out via: -* [Email](mailto:versedev.store@proton.me) -* [Twitter](https://twitter.com/versenilvis) -* [GitHub issues](https://github.com/versenilvis/iris/issues/new) + +- [Email](mailto:versedev.store@proton.me) +- [Twitter](https://twitter.com/versenilvis) +- [GitHub issues](https://github.com/versenilvis/iris/issues/new) diff --git a/flake.lock b/flake.lock index c06115a..b182e76 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,23 @@ { "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1782949081, + "narHash": "sha256-vp6Y/Grm98ESt6ceOkWiHWyZRDV3J1RID4w+6NWK9yA=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "17c9d6cdfc60c64f4ee8d306f9bc0b4ccb51481e", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1785090369, @@ -16,9 +34,41 @@ "type": "github" } }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1782614948, + "narHash": "sha256-ePjCwr1sNm9NYUqywL7QfK3JnlS015msC+eBu2zKlp8=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "db3f255737b94216eb71cce308e2912cf6bc2d7c", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, "root": { "inputs": { - "nixpkgs": "nixpkgs" + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs", + "systems": "systems" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index 7f58625..a70f5a5 100644 --- a/flake.nix +++ b/flake.nix @@ -1,52 +1,66 @@ { - description = "IRIS - Shell commands suggestion tool"; - inputs = { + systems.url = "github:nix-systems/default"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-parts.url = "github:hercules-ci/flake-parts"; }; - outputs = { self, nixpkgs }: - let - supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; - forAllSystems = nixpkgs.lib.genAttrs supportedSystems; - pkgsFor = system: nixpkgs.legacyPackages.${system}; - in + outputs = inputs @ {flake-parts, ...}: + flake-parts.lib.mkFlake { - packages = forAllSystems (system: - let - pkgs = pkgsFor system; - in - { - iris = pkgs.buildGoModule { - pname = "iris"; - version = self.shortRev or "dirty"; - src = ./.; + inherit inputs; + } + ( + { + inputs, + self, + ... + }: { + systems = import inputs.systems; + perSystem = { + pkgs, + self', + ... + }: { + packages = { + iris = pkgs.buildGoModule { + pname = "iris"; + version = self.shortRev or "dirty"; + src = pkgs.lib.cleanSource ./.; - subPackages = [ "cmd/iris" ]; + subPackages = ["cmd/iris"]; - proxyVendor = true; - vendorHash = "sha256-kBSMhUsuCKIjAXjGfl1WSjCX+tlGi9BTnkRu9ScW6M0="; + proxyVendor = true; + vendorHash = "sha256-kBSMhUsuCKIjAXjGfl1WSjCX+tlGi9BTnkRu9ScW6M0="; - doCheck = false; + doCheck = false; - meta = with pkgs.lib; { - description = "A shell auto-completion tool that works like code editor's IntelliSense"; - homepage = "https://github.com/versenilvis/iris"; - license = licenses.mit; - mainProgram = "iris"; + meta = with pkgs.lib; { + description = "A highly customizable, blazing fast and context-aware CLI autocomplete/navigation tool"; + homepage = "https://github.com/versenilvis/iris"; + license = licenses.mit; + mainProgram = "iris"; + }; }; + default = self'.packages.iris; }; - default = self.packages.${system}.iris; - }); - devShells = forAllSystems (system: - let - pkgs = pkgsFor system; - in - { - default = pkgs.mkShell { - buildInputs = with pkgs; [ go ]; + devShells.default = pkgs.mkShellNoCC { + # Tell Direnv to shut up. + DIRENV_LOG_FORMAT = ""; + + packages = [ + # languages + pkgs.go + pkgs.pkl + + # Tooling + pkgs.hk + pkgs.just + pkgs.alejandra + ]; }; - }); - }; + }; + } + ); } diff --git a/hk.pkl b/hk.pkl new file mode 100644 index 0000000..4717813 --- /dev/null +++ b/hk.pkl @@ -0,0 +1,41 @@ +amends "package://github.com/jdx/hk/releases/download/v1.50.0/hk@1.50.0#/Config.pkl" + +import "package://github.com/jdx/hk/releases/download/v1.50.0/hk@1.50.0#/Builtins.pkl" + +local linters = new { + ["pkl"] = Builtins.pkl +} + +local formatter = new { + ["newlines"] = Builtins.newlines + ["fix-smart-quotes"] = Builtins.fix_smart_quotes + ["alejandra"] = (Builtins.alejandra) { + exclude = List("**/npins/default.nix") + } + ["pkl-format"] = Builtins.pkl_format + ["just-format"] = Builtins.just_format +} + +hooks { + ["pre-commit"] { + fix = true + stash = "git" + steps { + ...linters + ...formatter + } + } + ["fix"] { + fix = true + steps { + ...linters + ...formatter + } + } + ["check"] { + steps { + ...linters + ...formatter + } + } +} diff --git a/packaging/aqua/registry.yaml b/packaging/aqua/registry.yaml new file mode 100644 index 0000000..041b201 --- /dev/null +++ b/packaging/aqua/registry.yaml @@ -0,0 +1,17 @@ +packages: + - type: github_release + repo_owner: versenilvis + repo_name: iris + description: "A highly customizable, blazing fast and context-aware CLI autocomplete/navigation tool" + asset: "iris_{{.OS}}_{{.Arch}}.{{.Format}}" + format: tar.gz + bin: + - iris + checksum: + type: github_release + asset: checksums.txt + file_format: regexp + algorithm: sha256 + pattern: + checksum: ^(\b[A-Fa-f0-9]{64}\b) + file: "^\\b[A-Fa-f0-9]{64}\\b\\s+(.*)$" diff --git a/packaging/asdf/LICENSE b/packaging/asdf/LICENSE new file mode 100644 index 0000000..f5f404b --- /dev/null +++ b/packaging/asdf/LICENSE @@ -0,0 +1,12 @@ +BSD Zero Clause License + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. diff --git a/packaging/asdf/bin/download b/packaging/asdf/bin/download new file mode 100755 index 0000000..5023ecd --- /dev/null +++ b/packaging/asdf/bin/download @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +set -euo pipefail + +[ -n "$ASDF_INSTALL_VERSION" ] || { echo "ASDF_INSTALL_VERSION is required" >&2; exit 1; } +[ -n "$ASDF_DOWNLOAD_PATH" ] || { echo "ASDF_DOWNLOAD_PATH is required" >&2; exit 1; } + +OS=$(uname -s | tr '[:upper:]' '[:lower:]') +ARCH=$(uname -m) + +case "$ARCH" in + x86_64) ARCH="amd64" ;; + aarch64) ARCH="arm64" ;; +esac + +URL="https://github.com/versenilvis/iris/releases/download/v${ASDF_INSTALL_VERSION}/iris_${OS}_${ARCH}.tar.gz" + +echo "Downloading Iris from $URL" +curl -sSL "$URL" -o "$ASDF_DOWNLOAD_PATH/iris.tar.gz" +tar -xzf "$ASDF_DOWNLOAD_PATH/iris.tar.gz" -C "$ASDF_DOWNLOAD_PATH" +rm "$ASDF_DOWNLOAD_PATH/iris.tar.gz" diff --git a/packaging/asdf/bin/install b/packaging/asdf/bin/install new file mode 100755 index 0000000..c9964f3 --- /dev/null +++ b/packaging/asdf/bin/install @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +set -euo pipefail + +[ -n "$ASDF_INSTALL_PATH" ] || { echo "ASDF_INSTALL_PATH is required" >&2; exit 1; } +[ -n "$ASDF_DOWNLOAD_PATH" ] || { echo "ASDF_DOWNLOAD_PATH is required" >&2; exit 1; } + +mkdir -p "$ASDF_INSTALL_PATH/bin" +cp "$ASDF_DOWNLOAD_PATH/iris" "$ASDF_INSTALL_PATH/bin/iris" +chmod +x "$ASDF_INSTALL_PATH/bin/iris" diff --git a/packaging/asdf/bin/list-all b/packaging/asdf/bin/list-all new file mode 100755 index 0000000..903d8cc --- /dev/null +++ b/packaging/asdf/bin/list-all @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +git ls-remote --tags --refs "https://github.com/versenilvis/iris.git" \ + | grep -o 'refs/tags/v[0-9].*' \ + | cut -d/ -f3- \ + | sed 's/^v//' \ + | sort -t. -k 1,1n -k 2,2n -k 3,3n diff --git a/scripts/aur.install b/scripts/aur.install new file mode 100644 index 0000000..fa214bf --- /dev/null +++ b/scripts/aur.install @@ -0,0 +1,9 @@ +pre_remove() { + echo "" + echo "=========================================================================" + echo " WARNING: To completely remove IRIS configurations and shell hooks," + echo " please run 'iris uninstall' BEFORE removing this package, or manually" + echo " clean up ~/.config/iris and your shell RC files (e.g. ~/.zshrc)." + echo "=========================================================================" + echo "" +} diff --git a/scripts/install.sh b/scripts/install.sh index f1cf403..77e7689 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -155,7 +155,7 @@ get_download_url() { err "GitHub API error (HTTP ${http_code}): ${msg}" fi - url=$(echo "${releases}" | grep "browser_download_url" | grep "${arch}" | head -1 | cut -d '"' -f 4) + url=$(echo "${releases}" | grep "browser_download_url" | grep "${arch}\.tar\.gz" | head -1 | cut -d '"' -f 4) echo "${url}" } diff --git a/scripts/prerm.sh b/scripts/prerm.sh new file mode 100755 index 0000000..a205e72 --- /dev/null +++ b/scripts/prerm.sh @@ -0,0 +1,11 @@ +#!/bin/sh +action="$1" +if [ "$action" = "remove" ] || [ "$action" = "0" ]; then + echo "" + echo "=========================================================================" + echo " WARNING: To completely remove IRIS configurations and shell hooks," + echo " please run 'iris uninstall' BEFORE removing this package, or manually" + echo " clean up ~/.config/iris and your shell RC files (e.g. ~/.zshrc)." + echo "=========================================================================" + echo "" +fi