Skip to content

[FEATURE]: Add standard CLI flags to install script (--help, --version, --no-modify-path) #5884

@anntnzrb

Description

@anntnzrb

Summary

The install script (curl -fsSL https://opencode.ai/install | bash) currently lacks standard CLI flags that users expect from modern install scripts. This proposal adds basic flags following conventions established by widely-used installers.

Problem

  • No --help - Users can't discover available options without reading the source code
  • No --version flag - The VERSION env var works, but flags are more discoverable and ergonomic
  • No --no-modify-path - The script modifies shell config files (.zshrc, .bashrc, etc.) without an opt-out, which causes issues on:
    • NixOS with home-manager (config files are read-only symlinks to /nix/store/...)
    • Immutable distros (Fedora Silverblue, etc.)
    • Declarative dotfile managers (chezmoi, yadm, GNU Stow)
  • Unknown flags are silently ignored - Typos like --no-modify instead of --no-modify-path fail silently

Proposed Flags

Flag Description
-h, --help Display usage information
-v, --version <ver> Install a specific version
--no-modify-path Don't modify shell config files

Additionally, unknown arguments should produce a warning so users are aware of typos.

Example Usage

# Show available options
curl -fsSL https://opencode.ai/install | bash -s -- --help

# Install a specific version
curl -fsSL https://opencode.ai/install | bash -s -- --version 1.0.180

# Install without modifying shell configs (for Nix users, etc.)
curl -fsSL https://opencode.ai/install | bash -s -- --no-modify-path
Research: How other installers handle this

I surveyed several popular and battle-tested install scripts to understand common conventions:

Rustup (Rust toolchain installer)

The gold standard for install scripts. Provides comprehensive flags:

Options:
  -v, --verbose           Enable verbose output
  -q, --quiet             Disable progress output
  -y                      Disable confirmation prompt
      --no-modify-path    Don't configure the PATH environment variable
  -h, --help              Print help
  -V, --version           Print version

Notable: --no-modify-path is exactly what we need for NixOS/immutable systems.

Determinate Nix Installer

A modern installer that downloads a binary and passes args through. Supports:

--no-confirm              Accept defaults, non-interactive mode

The script itself is minimal - it downloads the real installer binary which has extensive options.

Homebrew

Simple and focused:

Usage: [NONINTERACTIVE=1] [CI=1] install.sh [options]
    -h, --help       Display this message.

Also supports NONINTERACTIVE and CI environment variables for automated installs.

Starship (shell prompt)

Feature-rich installer with good UX:

Options:
  -V, --verbose             Enable verbose output
  -f, -y, --force, --yes    Skip the confirmation prompt
  -p, --platform            Override the platform
  -b, --bin-dir             Override the bin installation directory
  -v, --version             Install a specific version
  -h, --help                Display this help message

Notable: Uses -v, --version to specify which version to install (not print version).

ghcup (Haskell toolchain)

Uses environment variables for configuration:

BOOTSTRAP_HASKELL_NONINTERACTIVE  - noninteractive installation
BOOTSTRAP_HASKELL_VERBOSE         - more verbose installation
BOOTSTRAP_HASKELL_GHC_VERSION     - specific GHC version to install
BOOTSTRAP_HASKELL_ADJUST_BASHRC   - whether to adjust PATH in bashrc

Summary

Feature Rustup Homebrew Starship Determinate ghcup
--help ❌ (env vars)
--version (install specific) ✅ (env var)
--no-modify-path ✅ (env var)
--quiet
Non-interactive mode ✅ (-y) ✅ (env var) ✅ (-y) ✅ (env var)

Additional Notes

  • All changes are backward compatible - existing usage continues to work
  • Currently "no config file found" exits with an error - this could be changed to a warning, allowing the install to succeed regardless
  • The VERSION environment variable can remain as an alternative to --version

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions