typo fix
This commit is contained in:
8
.github/workflows/test.yml
vendored
8
.github/workflows/test.yml
vendored
@@ -23,7 +23,7 @@ jobs:
|
|||||||
sudo apt-get install -y bash zsh curl jq bc bash-completion bats
|
sudo apt-get install -y bash zsh curl jq bc bash-completion bats
|
||||||
|
|
||||||
- name: Make script executable
|
- name: Make script executable
|
||||||
run: chmod +x inish .sh
|
run: chmod +x finish.sh
|
||||||
|
|
||||||
- name: Run BATS tests
|
- name: Run BATS tests
|
||||||
run: |
|
run: |
|
||||||
@@ -37,8 +37,8 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
export HOME=$PWD/test-home
|
export HOME=$PWD/test-home
|
||||||
mkdir -p $HOME/.local/bin
|
mkdir -p $HOME/.local/bin
|
||||||
cp inish .sh $HOME/.local/bin/inish
|
cp finish.sh $HOME/.local/bin/finish
|
||||||
chmod +x $HOME/.local/bin/inish
|
chmod +x $HOME/.local/bin/finish
|
||||||
$HOME/.local/bin/finish --help
|
$HOME/.local/bin/finish --help
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
@@ -52,7 +52,7 @@ jobs:
|
|||||||
run: sudo apt-get update && sudo apt-get install -y shellcheck
|
run: sudo apt-get update && sudo apt-get install -y shellcheck
|
||||||
|
|
||||||
- name: Run shellcheck
|
- name: Run shellcheck
|
||||||
run: shellcheck inish .sh docs/install.sh || true
|
run: shellcheck finish.sh docs/install.sh || true
|
||||||
|
|
||||||
docker:
|
docker:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# inish .sh Docker Image
|
# finish.sh Docker Image
|
||||||
FROM ubuntu:22.04
|
FROM ubuntu:22.04
|
||||||
|
|
||||||
LABEL maintainer="finish contributors"
|
LABEL maintainer="finish contributors"
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
# Publishing Guide for inish .sh
|
# Publishing Guide for finish.sh
|
||||||
|
|
||||||
This guide explains how to publish and distribute inish .sh through various channels.
|
This guide explains how to publish and distribute finish.sh through various channels.
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
inish .sh can be distributed through multiple channels:
|
finish.sh can be distributed through multiple channels:
|
||||||
1. **Direct installation script** - One-line curl install
|
1. **Direct installation script** - One-line curl install
|
||||||
2. **Debian/Ubuntu packages** - APT repository
|
2. **Debian/Ubuntu packages** - APT repository
|
||||||
3. **Homebrew** - macOS package manager
|
3. **Homebrew** - macOS package manager
|
||||||
@@ -22,7 +22,7 @@ Before publishing, ensure:
|
|||||||
## Version Management
|
## Version Management
|
||||||
|
|
||||||
Update version numbers in these files:
|
Update version numbers in these files:
|
||||||
1. `inish .sh` - Line 34: `export ACSH_VERSION=0.5.0`
|
1. `finish.sh` - Line 34: `export ACSH_VERSION=0.5.0`
|
||||||
2. `debian/changelog` - Add new entry
|
2. `debian/changelog` - Add new entry
|
||||||
3. `homebrew/finish.rb` - Line 6: `version "0.5.0"`
|
3. `homebrew/finish.rb` - Line 6: `version "0.5.0"`
|
||||||
4. `docs/install.sh` - Line 7: `ACSH_VERSION="v0.5.0"`
|
4. `docs/install.sh` - Line 7: `ACSH_VERSION="v0.5.0"`
|
||||||
@@ -102,12 +102,12 @@ sudo apt-get install finish
|
|||||||
|
|
||||||
2. Create `apt-repo/conf/distributions`:
|
2. Create `apt-repo/conf/distributions`:
|
||||||
```
|
```
|
||||||
Origin: inish .sh
|
Origin: finish.sh
|
||||||
Label: finish
|
Label: finish
|
||||||
Codename: stable
|
Codename: stable
|
||||||
Architectures: all
|
Architectures: all
|
||||||
Components: main
|
Components: main
|
||||||
Description: APT repository for inish .sh
|
Description: APT repository for finish.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Add packages:
|
3. Add packages:
|
||||||
@@ -221,7 +221,7 @@ The `.github/workflows/release.yml` workflow automatically:
|
|||||||
2. Create release on GitHub:
|
2. Create release on GitHub:
|
||||||
- Go to Releases → Draft a new release
|
- Go to Releases → Draft a new release
|
||||||
- Tag: `v0.5.0`
|
- Tag: `v0.5.0`
|
||||||
- Title: `inish .sh v0.5.0`
|
- Title: `finish.sh v0.5.0`
|
||||||
- Upload: tarball and .deb file
|
- Upload: tarball and .deb file
|
||||||
- Write release notes
|
- Write release notes
|
||||||
|
|
||||||
|
|||||||
18
README.md
18
README.md
@@ -1,4 +1,4 @@
|
|||||||
# inish .sh
|
# finish.sh
|
||||||
|
|
||||||
Command-line completion powered by local LLMs. Press `Tab` twice and get intelligent suggestions based on your terminal context.
|
Command-line completion powered by local LLMs. Press `Tab` twice and get intelligent suggestions based on your terminal context.
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ See [Installation](#installation) below for package managers, Docker, and more o
|
|||||||
|
|
||||||
## What It Does
|
## What It Does
|
||||||
|
|
||||||
inish .sh enhances your terminal with context-aware command suggestions. It analyzes:
|
finish.sh enhances your terminal with context-aware command suggestions. It analyzes:
|
||||||
|
|
||||||
- Current directory and recent files
|
- Current directory and recent files
|
||||||
- Command history
|
- Command history
|
||||||
@@ -129,7 +129,7 @@ source ~/.bashrc
|
|||||||
|
|
||||||
### Docker
|
### Docker
|
||||||
|
|
||||||
Run inish .sh in a container:
|
Run finish.sh in a container:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Build the image
|
# Build the image
|
||||||
@@ -173,16 +173,16 @@ source ~/.bashrc
|
|||||||
## Directory Structure
|
## Directory Structure
|
||||||
|
|
||||||
```
|
```
|
||||||
~/.inish /
|
~/.finish/
|
||||||
├── config # Configuration file
|
├── config # Configuration file
|
||||||
├── inish .log # Usage log
|
├── finish.log # Usage log
|
||||||
└── cache/ # Cached completions
|
└── cache/ # Cached completions
|
||||||
```
|
```
|
||||||
|
|
||||||
## Commands
|
## Commands
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
finish install # Set up inish
|
finish install # Set up finish
|
||||||
finish remove # Uninstall
|
finish remove # Uninstall
|
||||||
finish config # Show/edit configuration
|
finish config # Show/edit configuration
|
||||||
finish model # Select model
|
finish model # Select model
|
||||||
@@ -201,7 +201,7 @@ Currently supports:
|
|||||||
- **LM-Studio** (default) - Local models via OpenAI-compatible API
|
- **LM-Studio** (default) - Local models via OpenAI-compatible API
|
||||||
- **Ollama** - Local models via Ollama API
|
- **Ollama** - Local models via Ollama API
|
||||||
|
|
||||||
Add custom providers by editing `inish .sh` and adding entries to `_inish _modellist`.
|
Add custom providers by editing `finish.sh` and adding entries to `_finish_modellist`.
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
@@ -212,7 +212,7 @@ Clone and link for development:
|
|||||||
```bash
|
```bash
|
||||||
git clone https://git.appmodel.nl/Tour/finish.git finish
|
git clone https://git.appmodel.nl/Tour/finish.git finish
|
||||||
cd finish
|
cd finish
|
||||||
ln -s $PWD/inish .sh $HOME/.local/bin/finish
|
ln -s $PWD/finish.sh $HOME/.local/bin/finish
|
||||||
finish install
|
finish install
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -262,7 +262,7 @@ docker-compose build
|
|||||||
|
|
||||||
### Creating a Release
|
### Creating a Release
|
||||||
|
|
||||||
1. Update version in `inish .sh` (ACSH_VERSION)
|
1. Update version in `finish.sh` (ACSH_VERSION)
|
||||||
2. Update version in `debian/changelog`
|
2. Update version in `debian/changelog`
|
||||||
3. Update version in `homebrew/finish.rb`
|
3. Update version in `homebrew/finish.rb`
|
||||||
4. Create and push a git tag:
|
4. Create and push a git tag:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Publication Setup Summary
|
# Publication Setup Summary
|
||||||
|
|
||||||
This document summarizes the publication setup completed for inish .sh.
|
This document summarizes the publication setup completed for finish.sh.
|
||||||
|
|
||||||
## Files Created
|
## Files Created
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ docker run -it ghcr.io/closedloop-technologies/finish:latest
|
|||||||
```bash
|
```bash
|
||||||
git clone https://git.appmodel.nl/Tour/finish.git
|
git clone https://git.appmodel.nl/Tour/finish.git
|
||||||
cd finish
|
cd finish
|
||||||
./inish .sh install
|
./finish.sh install
|
||||||
```
|
```
|
||||||
|
|
||||||
## Next Steps
|
## Next Steps
|
||||||
@@ -102,7 +102,7 @@ cd finish
|
|||||||
|
|
||||||
### For First Release
|
### For First Release
|
||||||
1. **Update version numbers** in:
|
1. **Update version numbers** in:
|
||||||
- `inish .sh` (line 34)
|
- `finish.sh` (line 34)
|
||||||
- `debian/changelog`
|
- `debian/changelog`
|
||||||
- `homebrew/finish.rb`
|
- `homebrew/finish.rb`
|
||||||
- `docs/install.sh`
|
- `docs/install.sh`
|
||||||
|
|||||||
6
USAGE.md
6
USAGE.md
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
Install and set up inish :
|
Install and set up finish:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
finish install
|
finish install
|
||||||
@@ -105,7 +105,7 @@ Remove finish completely:
|
|||||||
finish remove
|
finish remove
|
||||||
```
|
```
|
||||||
|
|
||||||
## Using inish
|
## Using finish
|
||||||
|
|
||||||
Once enabled, just type a command and press `Tab` twice to get suggestions:
|
Once enabled, just type a command and press `Tab` twice to get suggestions:
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@ Natural language also works:
|
|||||||
|
|
||||||
## Configuration File
|
## Configuration File
|
||||||
|
|
||||||
The config file is located at `~/.inish /config` and contains:
|
The config file is located at `~/.finish/config` and contains:
|
||||||
|
|
||||||
- `provider`: Model provider (lmstudio, ollama)
|
- `provider`: Model provider (lmstudio, ollama)
|
||||||
- `model`: Model name
|
- `model`: Model name
|
||||||
|
|||||||
2
debian/changelog
vendored
2
debian/changelog
vendored
@@ -7,4 +7,4 @@ finish (0.5.0-1) stable; urgency=medium
|
|||||||
* Intelligent caching system
|
* Intelligent caching system
|
||||||
* Privacy-focused local operation
|
* Privacy-focused local operation
|
||||||
|
|
||||||
-- inish .sh Contributors <noreply@inish .sh> Mon, 02 Dec 2024 12:00:00 +0000
|
-- finish.sh Contributors <noreply@finish.sh> Mon, 02 Dec 2024 12:00:00 +0000
|
||||||
|
|||||||
4
debian/control
vendored
4
debian/control
vendored
@@ -1,7 +1,7 @@
|
|||||||
Source: finish
|
Source: finish
|
||||||
Section: utils
|
Section: utils
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Maintainer: inish .sh Contributors <noreply@inish .sh>
|
Maintainer: finish.sh Contributors <noreply@finish.sh>
|
||||||
Build-Depends: debhelper (>= 10)
|
Build-Depends: debhelper (>= 10)
|
||||||
Standards-Version: 4.5.0
|
Standards-Version: 4.5.0
|
||||||
Homepage: https://git.appmodel.nl/Tour/finish/finish
|
Homepage: https://git.appmodel.nl/Tour/finish/finish
|
||||||
@@ -12,7 +12,7 @@ Architecture: all
|
|||||||
Depends: bash (>= 4.0) | zsh (>= 5.0), curl, jq, bc, bash-completion
|
Depends: bash (>= 4.0) | zsh (>= 5.0), curl, jq, bc, bash-completion
|
||||||
Recommends: lm-studio | ollama
|
Recommends: lm-studio | ollama
|
||||||
Description: LLM-powered command-line finishtion
|
Description: LLM-powered command-line finishtion
|
||||||
inish .sh enhances your terminal with context-aware command suggestions
|
finish.sh enhances your terminal with context-aware command suggestions
|
||||||
using local large language models. Features include:
|
using local large language models. Features include:
|
||||||
.
|
.
|
||||||
* Local-first operation with LM-Studio or Ollama
|
* Local-first operation with LM-Studio or Ollama
|
||||||
|
|||||||
2
debian/copyright
vendored
2
debian/copyright
vendored
@@ -4,7 +4,7 @@ Upstream-Contact: https://git.appmodel.nl/Tour/finish/finish
|
|||||||
Source: https://git.appmodel.nl/Tour/finish
|
Source: https://git.appmodel.nl/Tour/finish
|
||||||
|
|
||||||
Files: *
|
Files: *
|
||||||
Copyright: 2024-2025 inish .sh Contributors
|
Copyright: 2024-2025 finish.sh Contributors
|
||||||
License: BSD-2-Clause
|
License: BSD-2-Clause
|
||||||
|
|
||||||
License: BSD-2-Clause
|
License: BSD-2-Clause
|
||||||
|
|||||||
2
debian/postinst
vendored
2
debian/postinst
vendored
@@ -3,7 +3,7 @@ set -e
|
|||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
configure)
|
configure)
|
||||||
echo "inish .sh has been installed successfully!"
|
echo "finish.sh has been installed successfully!"
|
||||||
echo ""
|
echo ""
|
||||||
echo "To complete setup, run:"
|
echo "To complete setup, run:"
|
||||||
echo " finish install"
|
echo " finish install"
|
||||||
|
|||||||
2
debian/rules
vendored
2
debian/rules
vendored
@@ -8,7 +8,7 @@
|
|||||||
dh $@
|
dh $@
|
||||||
|
|
||||||
override_dh_auto_install:
|
override_dh_auto_install:
|
||||||
install -D -m 0755 inish .sh $(CURDIR)/debian/finish/usr/bin/inish
|
install -D -m 0755 finish.sh $(CURDIR)/debian/finish/usr/bin/finish
|
||||||
install -D -m 0644 LICENSE $(CURDIR)/debian/finish/usr/share/doc/finish/copyright
|
install -D -m 0644 LICENSE $(CURDIR)/debian/finish/usr/share/doc/finish/copyright
|
||||||
install -D -m 0644 README.md $(CURDIR)/debian/finish/usr/share/doc/finish/README.md
|
install -D -m 0644 README.md $(CURDIR)/debian/finish/usr/share/doc/finish/README.md
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
inish
|
finish
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# inish .sh installer
|
# finish.sh installer
|
||||||
# Usage: curl -sSL https://git.appmodel.nl/Tour/finish/raw/branch/main/docs/install.sh | bash
|
# Usage: curl -sSL https://git.appmodel.nl/Tour/finish/raw/branch/main/docs/install.sh | bash
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
@@ -88,7 +88,7 @@ download_file() {
|
|||||||
# Main installation
|
# Main installation
|
||||||
main() {
|
main() {
|
||||||
echo_green "=========================================="
|
echo_green "=========================================="
|
||||||
echo_green " inish .sh Installation"
|
echo_green " finish.sh Installation"
|
||||||
echo_green " Version: $ACSH_VERSION"
|
echo_green " Version: $ACSH_VERSION"
|
||||||
echo_green "=========================================="
|
echo_green "=========================================="
|
||||||
echo ""
|
echo ""
|
||||||
@@ -97,11 +97,11 @@ main() {
|
|||||||
SHELL_TYPE=$(detect_shell)
|
SHELL_TYPE=$(detect_shell)
|
||||||
case "$SHELL_TYPE" in
|
case "$SHELL_TYPE" in
|
||||||
zsh)
|
zsh)
|
||||||
SCRIPT_NAME="inish .zsh"
|
SCRIPT_NAME="finish.zsh"
|
||||||
RC_FILE="$HOME/.zshrc"
|
RC_FILE="$HOME/.zshrc"
|
||||||
;;
|
;;
|
||||||
bash)
|
bash)
|
||||||
SCRIPT_NAME="inish .sh"
|
SCRIPT_NAME="finish.sh"
|
||||||
RC_FILE="$HOME/.bashrc"
|
RC_FILE="$HOME/.bashrc"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@@ -122,7 +122,7 @@ main() {
|
|||||||
|
|
||||||
# Determine installation location
|
# Determine installation location
|
||||||
if [ -d "$HOME/.local/bin" ]; then
|
if [ -d "$HOME/.local/bin" ]; then
|
||||||
INSTALL_LOCATION="$HOME/.local/bin/inish "
|
INSTALL_LOCATION="$HOME/.local/bin/finish"
|
||||||
# Add to PATH if not already there
|
# Add to PATH if not already there
|
||||||
if ! echo "$PATH" | grep -q "$HOME/.local/bin"; then
|
if ! echo "$PATH" | grep -q "$HOME/.local/bin"; then
|
||||||
echo_warning "$HOME/.local/bin is not in PATH"
|
echo_warning "$HOME/.local/bin is not in PATH"
|
||||||
@@ -132,7 +132,7 @@ main() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
elif [ -w "/usr/local/bin" ]; then
|
elif [ -w "/usr/local/bin" ]; then
|
||||||
INSTALL_LOCATION="/usr/local/bin/inish "
|
INSTALL_LOCATION="/usr/local/bin/finish"
|
||||||
else
|
else
|
||||||
echo_error "Cannot write to /usr/local/bin and $HOME/.local/bin doesn't exist"
|
echo_error "Cannot write to /usr/local/bin and $HOME/.local/bin doesn't exist"
|
||||||
echo "Please create $HOME/.local/bin or run with sudo"
|
echo "Please create $HOME/.local/bin or run with sudo"
|
||||||
@@ -143,7 +143,7 @@ main() {
|
|||||||
mkdir -p "$(dirname "$INSTALL_LOCATION")"
|
mkdir -p "$(dirname "$INSTALL_LOCATION")"
|
||||||
|
|
||||||
# Download script
|
# Download script
|
||||||
echo "Downloading inish .sh..."
|
echo "Downloading finish.sh..."
|
||||||
URL="$REPO_URL/$BRANCH_OR_VERSION/$SCRIPT_NAME"
|
URL="$REPO_URL/$BRANCH_OR_VERSION/$SCRIPT_NAME"
|
||||||
if ! download_file "$URL" "$INSTALL_LOCATION"; then
|
if ! download_file "$URL" "$INSTALL_LOCATION"; then
|
||||||
echo_error "Failed to download from $URL"
|
echo_error "Failed to download from $URL"
|
||||||
|
|||||||
114
finish.sh
114
finish.sh
@@ -23,12 +23,12 @@ echo_green() {
|
|||||||
|
|
||||||
export ACSH_VERSION=0.5.0
|
export ACSH_VERSION=0.5.0
|
||||||
|
|
||||||
unset _inish _modellist
|
unset _finish_modellist
|
||||||
declare -A _inish _modellist
|
declare -A _finish_modellist
|
||||||
# LM-Studio models
|
# LM-Studio models
|
||||||
_inish _modellist['lmstudio: darkidol-llama-3.1-8b-instruct-1.3-uncensored_gguf:2']='{ "completion_cost":0.0000000, "prompt_cost":0.0000000, "endpoint": "http://localhost:1234/v1/chat/completions", "model": "darkidol-llama-3.1-8b-instruct-1.3-uncensored_gguf:2", "provider": "lmstudio" }'
|
_finish_modellist['lmstudio: darkidol-llama-3.1-8b-instruct-1.3-uncensored_gguf:2']='{ "completion_cost":0.0000000, "prompt_cost":0.0000000, "endpoint": "http://localhost:1234/v1/chat/completions", "model": "darkidol-llama-3.1-8b-instruct-1.3-uncensored_gguf:2", "provider": "lmstudio" }'
|
||||||
# Ollama model
|
# Ollama model
|
||||||
_inish _modellist['ollama: codellama']='{ "completion_cost":0.0000000, "prompt_cost":0.0000000, "endpoint": "http://localhost:11434/api/chat", "model": "codellama", "provider": "ollama" }'
|
_finish_modellist['ollama: codellama']='{ "completion_cost":0.0000000, "prompt_cost":0.0000000, "endpoint": "http://localhost:11434/api/chat", "model": "codellama", "provider": "ollama" }'
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# System Information Functions #
|
# System Information Functions #
|
||||||
@@ -343,7 +343,7 @@ list_cache() {
|
|||||||
find "$cache_dir" -maxdepth 1 -type f -name "acsh-*" -printf '%T+ %p\n' | sort
|
find "$cache_dir" -maxdepth 1 -type f -name "acsh-*" -printf '%T+ %p\n' | sort
|
||||||
}
|
}
|
||||||
|
|
||||||
_inish sh() {
|
_finishsh() {
|
||||||
_init_completion || return
|
_init_completion || return
|
||||||
_default_completion
|
_default_completion
|
||||||
if [[ ${#COMPREPLY[@]} -eq 0 && $COMP_TYPE -eq 63 ]]; then
|
if [[ ${#COMPREPLY[@]} -eq 0 && $COMP_TYPE -eq 63 ]]; then
|
||||||
@@ -528,7 +528,7 @@ set_config() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
config_command() {
|
config_command() {
|
||||||
local command config_file="$HOME/.inish /config"
|
local command config_file="$HOME/.finish/config"
|
||||||
command="${*:2}"
|
command="${*:2}"
|
||||||
if [ -z "$command" ]; then
|
if [ -z "$command" ]; then
|
||||||
show_config
|
show_config
|
||||||
@@ -551,10 +551,10 @@ config_command() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
build_config() {
|
build_config() {
|
||||||
local config_file="$HOME/.inish /config" default_config
|
local config_file="$HOME/.finish/config" default_config
|
||||||
if [ ! -f "$config_file" ]; then
|
if [ ! -f "$config_file" ]; then
|
||||||
echo "Creating default configuration file at ~/.inish /config"
|
echo "Creating default configuration file at ~/.finish/config"
|
||||||
default_config="# ~/.inish /config
|
default_config="# ~/.finish/config
|
||||||
|
|
||||||
# Model configuration
|
# Model configuration
|
||||||
provider: lmstudio
|
provider: lmstudio
|
||||||
@@ -569,17 +569,17 @@ max_history_commands: 20
|
|||||||
max_recent_files: 20
|
max_recent_files: 20
|
||||||
|
|
||||||
# Cache settings
|
# Cache settings
|
||||||
cache_dir: $HOME/.inish /cache
|
cache_dir: $HOME/.finish/cache
|
||||||
cache_size: 10
|
cache_size: 10
|
||||||
|
|
||||||
# Logging settings
|
# Logging settings
|
||||||
log_file: $HOME/.inish /inish .log"
|
log_file: $HOME/.finish/finish.log"
|
||||||
echo "$default_config" > "$config_file"
|
echo "$default_config" > "$config_file"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
acsh_load_config() {
|
acsh_load_config() {
|
||||||
local config_file="$HOME/.inish /config" key value
|
local config_file="$HOME/.finish/config" key value
|
||||||
if [ -f "$config_file" ]; then
|
if [ -f "$config_file" ]; then
|
||||||
while IFS=':' read -r key value; do
|
while IFS=':' read -r key value; do
|
||||||
if [[ $key =~ ^# ]] || [[ -z $key ]]; then
|
if [[ $key =~ ^# ]] || [[ -z $key ]]; then
|
||||||
@@ -610,72 +610,72 @@ acsh_load_config() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
install_command() {
|
install_command() {
|
||||||
local bashrc_file="$HOME/.bashrc" inish _setup="source finish enable" inish _cli_setup="complete -F _inish sh_cli inish "
|
local bashrc_file="$HOME/.bashrc" finish_setup="source finish enable" finish_cli_setup="complete -F _finishsh_cli finish"
|
||||||
if ! command -v finish &>/dev/null; then
|
if ! command -v finish &>/dev/null; then
|
||||||
echo_error "inish .sh not in PATH. Follow install instructions at https://git.appmodel.nl/Tour/finish"
|
echo_error "finish.sh not in PATH. Follow install instructions at https://git.appmodel.nl/Tour/finish"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if [[ ! -d "$HOME/.inish " ]]; then
|
if [[ ! -d "$HOME/.finish" ]]; then
|
||||||
echo "Creating ~/.finish directory"
|
echo "Creating ~/.finish directory"
|
||||||
mkdir -p "$HOME/.inish "
|
mkdir -p "$HOME/.finish"
|
||||||
fi
|
fi
|
||||||
local cache_dir=${ACSH_CACHE_DIR:-"$HOME/.inish /cache"}
|
local cache_dir=${ACSH_CACHE_DIR:-"$HOME/.finish/cache"}
|
||||||
if [[ ! -d "$cache_dir" ]]; then
|
if [[ ! -d "$cache_dir" ]]; then
|
||||||
mkdir -p "$cache_dir"
|
mkdir -p "$cache_dir"
|
||||||
fi
|
fi
|
||||||
build_config
|
build_config
|
||||||
acsh_load_config
|
acsh_load_config
|
||||||
if ! grep -qF "$inish _setup" "$bashrc_file"; then
|
if ! grep -qF "$finish_setup" "$bashrc_file"; then
|
||||||
echo -e "# inish .sh" >> "$bashrc_file"
|
echo -e "# finish.sh" >> "$bashrc_file"
|
||||||
echo -e "$inish _setup\n" >> "$bashrc_file"
|
echo -e "$finish_setup\n" >> "$bashrc_file"
|
||||||
echo "Added inish .sh setup to $bashrc_file"
|
echo "Added finish.sh setup to $bashrc_file"
|
||||||
else
|
else
|
||||||
echo "inish .sh setup already exists in $bashrc_file"
|
echo "finish.sh setup already exists in $bashrc_file"
|
||||||
fi
|
fi
|
||||||
if ! grep -qF "$inish _cli_setup" "$bashrc_file"; then
|
if ! grep -qF "$finish_cli_setup" "$bashrc_file"; then
|
||||||
echo -e "# inish .sh CLI" >> "$bashrc_file"
|
echo -e "# finish.sh CLI" >> "$bashrc_file"
|
||||||
echo -e "$inish _cli_setup\n" >> "$bashrc_file"
|
echo -e "$finish_cli_setup\n" >> "$bashrc_file"
|
||||||
echo "Added finish CLI completion to $bashrc_file"
|
echo "Added finish CLI completion to $bashrc_file"
|
||||||
fi
|
fi
|
||||||
echo
|
echo
|
||||||
echo_green "inish .sh - Version $ACSH_VERSION installation complete."
|
echo_green "finish.sh - Version $ACSH_VERSION installation complete."
|
||||||
echo -e "Run: source $bashrc_file to enable inish ."
|
echo -e "Run: source $bashrc_file to enable finish."
|
||||||
echo -e "Then run: finish model to select a language model."
|
echo -e "Then run: finish model to select a language model."
|
||||||
}
|
}
|
||||||
|
|
||||||
remove_command() {
|
remove_command() {
|
||||||
local config_file="$HOME/.inish /config" cache_dir=${ACSH_CACHE_DIR:-"$HOME/.inish /cache"} log_file=${ACSH_LOG_FILE:-"$HOME/.inish /inish .log"} bashrc_file="$HOME/.bashrc"
|
local config_file="$HOME/.finish/config" cache_dir=${ACSH_CACHE_DIR:-"$HOME/.finish/cache"} log_file=${ACSH_LOG_FILE:-"$HOME/.finish/finish.log"} bashrc_file="$HOME/.bashrc"
|
||||||
echo_green "Removing inish .sh installation..."
|
echo_green "Removing finish.sh installation..."
|
||||||
[ -f "$config_file" ] && { rm "$config_file"; echo "Removed: $config_file"; }
|
[ -f "$config_file" ] && { rm "$config_file"; echo "Removed: $config_file"; }
|
||||||
[ -d "$cache_dir" ] && { rm -rf "$cache_dir"; echo "Removed: $cache_dir"; }
|
[ -d "$cache_dir" ] && { rm -rf "$cache_dir"; echo "Removed: $cache_dir"; }
|
||||||
[ -f "$log_file" ] && { rm "$log_file"; echo "Removed: $log_file"; }
|
[ -f "$log_file" ] && { rm "$log_file"; echo "Removed: $log_file"; }
|
||||||
if [ -d "$HOME/.inish " ]; then
|
if [ -d "$HOME/.finish" ]; then
|
||||||
if [ -z "$(ls -A "$HOME/.inish ")" ]; then
|
if [ -z "$(ls -A "$HOME/.finish")" ]; then
|
||||||
rmdir "$HOME/.inish "
|
rmdir "$HOME/.finish"
|
||||||
echo "Removed: $HOME/.inish "
|
echo "Removed: $HOME/.finish"
|
||||||
else
|
else
|
||||||
echo "Skipped removing $HOME/.finish (not empty)"
|
echo "Skipped removing $HOME/.finish (not empty)"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ -f "$bashrc_file" ]; then
|
if [ -f "$bashrc_file" ]; then
|
||||||
if grep -qF "source finish enable" "$bashrc_file"; then
|
if grep -qF "source finish enable" "$bashrc_file"; then
|
||||||
sed -i '/# inish .sh/d' "$bashrc_file"
|
sed -i '/# finish.sh/d' "$bashrc_file"
|
||||||
sed -i '/inish /d' "$bashrc_file"
|
sed -i '/finish/d' "$bashrc_file"
|
||||||
echo "Removed inish .sh setup from $bashrc_file"
|
echo "Removed finish.sh setup from $bashrc_file"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
local inish _script
|
local finish_script
|
||||||
inish _script=$(command -v inish )
|
finish_script=$(command -v finish)
|
||||||
if [ -n "$inish _script" ]; then
|
if [ -n "$finish_script" ]; then
|
||||||
echo "finish script is at: $inish _script"
|
echo "finish script is at: $finish_script"
|
||||||
if [ "$1" == "-y" ]; then
|
if [ "$1" == "-y" ]; then
|
||||||
rm "$inish _script"
|
rm "$finish_script"
|
||||||
echo "Removed: $inish _script"
|
echo "Removed: $finish_script"
|
||||||
else
|
else
|
||||||
read -r -p "Remove the finish script? (y/n): " confirm
|
read -r -p "Remove the finish script? (y/n): " confirm
|
||||||
if [[ $confirm == "y" ]]; then
|
if [[ $confirm == "y" ]]; then
|
||||||
rm "$inish _script"
|
rm "$finish_script"
|
||||||
echo "Removed: $inish _script"
|
echo "Removed: $finish_script"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -684,11 +684,11 @@ remove_command() {
|
|||||||
|
|
||||||
check_if_enabled() {
|
check_if_enabled() {
|
||||||
local is_enabled
|
local is_enabled
|
||||||
is_enabled=$(complete -p | grep _inish sh | grep -cv _inish sh_cli)
|
is_enabled=$(complete -p | grep _finishsh | grep -cv _finishsh_cli)
|
||||||
(( is_enabled > 0 )) && return 0 || return 1
|
(( is_enabled > 0 )) && return 0 || return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
_inish sh_cli() {
|
_finishsh_cli() {
|
||||||
if [[ -n "${COMP_WORDS[*]}" ]]; then
|
if [[ -n "${COMP_WORDS[*]}" ]]; then
|
||||||
command="${COMP_WORDS[0]}"
|
command="${COMP_WORDS[0]}"
|
||||||
if [[ -n "$COMP_CWORD" && "$COMP_CWORD" -lt "${#COMP_WORDS[@]}" ]]; then
|
if [[ -n "$COMP_CWORD" && "$COMP_CWORD" -lt "${#COMP_WORDS[@]}" ]]; then
|
||||||
@@ -720,11 +720,11 @@ model
|
|||||||
|
|
||||||
enable_command() {
|
enable_command() {
|
||||||
if check_if_enabled; then
|
if check_if_enabled; then
|
||||||
echo_green "Reloading inish .sh..."
|
echo_green "Reloading finish.sh..."
|
||||||
disable_command
|
disable_command
|
||||||
fi
|
fi
|
||||||
acsh_load_config
|
acsh_load_config
|
||||||
complete -D -E -F _inish sh -o nospace
|
complete -D -E -F _finishsh -o nospace
|
||||||
}
|
}
|
||||||
|
|
||||||
disable_command() {
|
disable_command() {
|
||||||
@@ -747,7 +747,7 @@ command_command() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
clear_command() {
|
clear_command() {
|
||||||
local cache_dir=${ACSH_CACHE_DIR:-"$HOME/.inish /cache"} log_file=${ACSH_LOG_FILE:-"$HOME/.inish /inish .log"}
|
local cache_dir=${ACSH_CACHE_DIR:-"$HOME/.finish/cache"} log_file=${ACSH_LOG_FILE:-"$HOME/.finish/finish.log"}
|
||||||
echo "This will clear the cache and log file."
|
echo "This will clear the cache and log file."
|
||||||
echo -e "Cache directory: \e[31m$cache_dir\e[0m"
|
echo -e "Cache directory: \e[31m$cache_dir\e[0m"
|
||||||
echo -e "Log file: \e[31m$log_file\e[0m"
|
echo -e "Log file: \e[31m$log_file\e[0m"
|
||||||
@@ -774,10 +774,10 @@ clear_command() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
usage_command() {
|
usage_command() {
|
||||||
local log_file=${ACSH_LOG_FILE:-"$HOME/.inish /inish .log"} cache_dir=${ACSH_CACHE_DIR:-"$HOME/.inish /cache"}
|
local log_file=${ACSH_LOG_FILE:-"$HOME/.finish/finish.log"} cache_dir=${ACSH_CACHE_DIR:-"$HOME/.finish/cache"}
|
||||||
local cache_size number_of_lines api_cost avg_api_cost
|
local cache_size number_of_lines api_cost avg_api_cost
|
||||||
cache_size=$(list_cache | wc -l)
|
cache_size=$(list_cache | wc -l)
|
||||||
echo_green "inish .sh - Usage Information"
|
echo_green "finish.sh - Usage Information"
|
||||||
echo
|
echo
|
||||||
echo -n "Log file: "; echo -e "\e[90m$log_file\e[0m"
|
echo -n "Log file: "; echo -e "\e[90m$log_file\e[0m"
|
||||||
if [ ! -f "$log_file" ]; then
|
if [ ! -f "$log_file" ]; then
|
||||||
@@ -865,22 +865,22 @@ model_command() {
|
|||||||
clear
|
clear
|
||||||
local selected_model options=()
|
local selected_model options=()
|
||||||
if [[ $# -ne 3 ]]; then
|
if [[ $# -ne 3 ]]; then
|
||||||
mapfile -t sorted_keys < <(for key in "${!_inish _modellist[@]}"; do echo "$key"; done | sort)
|
mapfile -t sorted_keys < <(for key in "${!_finish_modellist[@]}"; do echo "$key"; done | sort)
|
||||||
for key in "${sorted_keys[@]}"; do
|
for key in "${sorted_keys[@]}"; do
|
||||||
options+=("$key")
|
options+=("$key")
|
||||||
done
|
done
|
||||||
echo -e "\e[1;32minish .sh - Model Configuration\e[0m"
|
echo -e "\e[1;32mfinish.sh - Model Configuration\e[0m"
|
||||||
menu_selector "${options[@]}"
|
menu_selector "${options[@]}"
|
||||||
selected_option=$?
|
selected_option=$?
|
||||||
if [[ $selected_option -eq 1 ]]; then
|
if [[ $selected_option -eq 1 ]]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
selected_model="${options[selected_option]}"
|
selected_model="${options[selected_option]}"
|
||||||
selected_value="${_inish _modellist[$selected_model]}"
|
selected_value="${_finish_modellist[$selected_model]}"
|
||||||
else
|
else
|
||||||
provider="$2"
|
provider="$2"
|
||||||
model_name="$3"
|
model_name="$3"
|
||||||
selected_value="${_inish _modellist["$provider: $model_name"]}"
|
selected_value="${_finish_modellist["$provider: $model_name"]}"
|
||||||
if [[ -z "$selected_value" ]]; then
|
if [[ -z "$selected_value" ]]; then
|
||||||
echo "ERROR: Invalid provider or model name."
|
echo "ERROR: Invalid provider or model name."
|
||||||
return 1
|
return 1
|
||||||
@@ -952,9 +952,9 @@ case "$1" in
|
|||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if [[ -n "$1" ]]; then
|
if [[ -n "$1" ]]; then
|
||||||
echo_error "Unknown command $1 - run 'finish --help' for usage or visit https://inish .sh"
|
echo_error "Unknown command $1 - run 'finish --help' for usage or visit https://finish.sh"
|
||||||
else
|
else
|
||||||
echo_green "inish .sh - LLM Powered Bash Completion - Version $ACSH_VERSION - https://inish .sh"
|
echo_green "finish.sh - LLM Powered Bash Completion - Version $ACSH_VERSION - https://finish.sh"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
class inish Sh < Formula
|
class finishSh < Formula
|
||||||
desc "LLM-powered command-line finishtion"
|
desc "LLM-powered command-line finishtion"
|
||||||
homepage "https://git.appmodel.nl/Tour/inish "
|
homepage "https://git.appmodel.nl/Tour/finish"
|
||||||
url "https://git.appmodel.nl/Tour/finish/archive/v0.5.0.tar.gz"
|
url "https://git.appmodel.nl/Tour/finish/archive/v0.5.0.tar.gz"
|
||||||
sha256 "" # Update with actual SHA256 of the release tarball
|
sha256 "" # Update with actual SHA256 of the release tarball
|
||||||
license "BSD-2-Clause"
|
license "BSD-2-Clause"
|
||||||
@@ -11,7 +11,7 @@ class inish Sh < Formula
|
|||||||
depends_on "bash-completion@2" => :optional
|
depends_on "bash-completion@2" => :optional
|
||||||
|
|
||||||
def install
|
def install
|
||||||
bin.install "inish .sh" => "inish "
|
bin.install "finish.sh" => "finish"
|
||||||
doc.install "README.md"
|
doc.install "README.md"
|
||||||
doc.install "LICENSE"
|
doc.install "LICENSE"
|
||||||
end
|
end
|
||||||
@@ -30,18 +30,18 @@ class inish Sh < Formula
|
|||||||
3. Select a language model:
|
3. Select a language model:
|
||||||
finish model
|
finish model
|
||||||
|
|
||||||
You'll need LM-Studio or Ollama running locally to use inish .sh.
|
You'll need LM-Studio or Ollama running locally to use finish.sh.
|
||||||
|
|
||||||
LM-Studio: https://lmstudio.ai
|
LM-Studio: https://lmstudio.ai
|
||||||
Ollama: https://ollama.ai
|
Ollama: https://ollama.ai
|
||||||
|
|
||||||
For more information, visit:
|
For more information, visit:
|
||||||
https:/git.appmodel.nl/Tour/inish
|
https:/git.appmodel.nl/Tour/finish
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
test do
|
test do
|
||||||
system "#{bin}/inish ", "--help"
|
system "#{bin}/finish", "--help"
|
||||||
assert_match "inish .sh", shell_output("#{bin}/finish --help")
|
assert_match "finish.sh", shell_output("#{bin}/finish --help")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env bats
|
#!/usr/bin/env bats
|
||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
# Install inish .sh and run testing against the main branch
|
# Install finish.sh and run testing against the main branch
|
||||||
wget -qO- https://git.appmodel.nl/Tour/finish/raw/branch/main/docs/install.sh | bash -s -- main
|
wget -qO- https://git.appmodel.nl/Tour/finish/raw/branch/main/docs/install.sh | bash -s -- main
|
||||||
|
|
||||||
# Source bashrc to make sure finish is available in the current session
|
# Source bashrc to make sure finish is available in the current session
|
||||||
@@ -14,18 +14,18 @@ setup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
teardown() {
|
teardown() {
|
||||||
# Remove inish .sh installation
|
# Remove finish.sh installation
|
||||||
finish remove -y
|
finish remove -y
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "which finish returns something" {
|
@test "which finish returns something" {
|
||||||
run which inish
|
run which finish
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ -n "$output" ]
|
[ -n "$output" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "finish returns a string containing inish .sh (case insensitive)" {
|
@test "finish returns a string containing finish.sh (case insensitive)" {
|
||||||
run inish
|
run finish
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[[ "$output" =~ [Aa]utocomplete\.sh ]]
|
[[ "$output" =~ [Aa]utocomplete\.sh ]]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user