Skip to content

Commit

Permalink
add install script (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
ITProKyle authored Dec 2, 2024
1 parent 362d360 commit ddb91be
Show file tree
Hide file tree
Showing 24 changed files with 2,544 additions and 8 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ on:
- master

jobs:
python-checks:
strategy:
matrix:
python-version: ['3.10', 3.11, 3.12]
uses: finleyfamily/workflows/.github/workflows/python.checks.yml@master
with:
disable-tests: true
python-version: ${{ matrix.python-version }}
shellcheck:
name: shellcheck
runs-on: ubuntu-latest
Expand Down
4 changes: 3 additions & 1 deletion .vscode/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@
],
"maxNumberOfProblems": 100,
"version": "0.2",
"words": []
"words": [
"gtar"
]
}
27 changes: 25 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,35 @@ help: ## show this message
'BEGIN {FS = ":.*##"; printf "\nUsage: make \033[36m<target>\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-30s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) }' \
$(MAKEFILE_LIST)

fix: run-pre-commit ## run all automatic fixes
fix: fix-ruff run-pre-commit ## run all automatic fixes

fix-imports: ## automatically fix all import sorting errors
@poetry run ruff check . --fix-only --fixable I001

fix-ruff: ## automatically fix everything ruff can fix (implies fix-imports)
@poetry run ruff check . --fix-only

fix-md: ## automatically fix markdown format errors
@poetry run pre-commit run mdformat --all-files

lint: lint-shellcheck ## run all linters
lint: lint-ruff lint-pyright ## run all linters
@if [[ "${CI}" == "yes" ]]; then \
echo ""; \
echo "skipped linters that have dedicated jobs"; \
else \
echo ""; \
$(MAKE) --no-print-directory lint-shellcheck; \
fi

lint-pyright: ## run pyright
@echo "Running pyright..."
@npm exec --no -- pyright --venvpath ./
@echo ""

lint-ruff: ## run ruff
@echo "Running ruff... If this fails, run 'make fix-ruff' to resolve some error automatically, other require manual action."
@poetry run ruff check .
@echo ""

lint-shellcheck: ## runs shellcheck using act
@act --job shellcheck
Expand Down
53 changes: 53 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,59 @@
OI! A zsh function library based on [bashio](https://github.com/hassio-addons/bashio) but for general use.
While primarily intended for use with zsh, OI should be mostly compatible with Bash.

## Installation

OI provides a [Python install script](https://github.com/finleyfamily/oi/blob/master/install.py) to make installation easy.
The install script requires Python ^3.10.

```console
curl -sSL https://raw.githubusercontent.com/finleyfamily/oi/refs/heads/master/install.py | python3 -
```

> ℹ️ **NOTE:** On some systems, `python` may still refer to Python 2 instead of Python 3.
> It is suggested to use the `python3` binary to avoid ambiguity.
To install a specific version of OI, the `--version` option can be passed to the script.

```console
curl -sSL https://raw.githubusercontent.com/finleyfamily/oi/refs/heads/master/install.py | python3 - --version 1.0.0
```

To install a pre-release version of OI, the `--allow-prereleases` flag can be provided.

```console
curl -sSL https://raw.githubusercontent.com/finleyfamily/oi/refs/heads/master/install.py | python3 - --allow-prereleases
```

By default the `.tar.gz` artifact of OI is installed.
If perferred, the `.zip` artifact can be used by passing `--artifact-type zip` to the script.

```console
curl -sSL https://raw.githubusercontent.com/finleyfamily/oi/refs/heads/master/install.py | python3 - --artifact-type zip
```

To uninstall OI, pass the `--uninstall` flag to the script.

```console
curl -sSL https://raw.githubusercontent.com/finleyfamily/oi/refs/heads/master/install.py | python3 - --uninstall
```

### Adding OI to your PATH

The install script creates an `oi` symlink in a well-known, platform-specific directory:

- `$HOME/.local/bin` on Linux/Unix/macOS

If this directory is not present in your `PATH`, it should be added.

Alternatively, the full path to the OI script can always be used:

- `~/.local/lib/oi/oi` on Linux/Unix/macOS

### Updating

To update OI, simply follow the steps in [Installation](#installation) section again.

## Usage

Configuring a zsh script to use the OI library is fairly easy. Simply replace the shebang of your script with from `zsh` to `oi`.
Expand Down
Loading

0 comments on commit ddb91be

Please sign in to comment.