An open API service indexing awesome lists of open source software.

https://github.com/phphleb/cli-completion

Autocompletion in the console for HLEB2 framework commands
https://github.com/phphleb/cli-completion

Last synced: 4 months ago
JSON representation

Autocompletion in the console for HLEB2 framework commands

Awesome Lists containing this project

README

          

## CLI-COMPLETION

[![HLEB2](https://img.shields.io/badge/HLEB-2-darkcyan)](https://github.com/phphleb/hleb) [![License: MIT](https://img.shields.io/badge/License-MIT%20(Free)-brightgreen.svg)](https://github.com/phphleb/hleb/blob/master/LICENSE)

Extends CLI support for the **HLEB2** [framework](https://github.com/phphleb/hleb/) >= v2.0.27

Install using Composer:
```bash
composer require phphleb/cli-completion
```

Or download the script file manually to a folder whose path you'll later specify in the initiator. In this case, you'll need to repeat the process to update the version.

--------------------------

> After installation, auto-completion of console commands (`php console `) by pressing **Tab** will substitute suitable framework commands.

> If you have several projects based on the HLEB2 framework, then copy the library files to the user's root folder and specify the path there.

## Bash

💾 Script file `/bash/hleb2bash.sh`

### Linux

For Linux, in a terminal running Bash, add the following line to the ~/.bashrc file. For instance, if the library is installed in a project located at /home/user/web/hleb/, add the following:

```bash
source /home/user/web/hleb/vendor/phphleb/cli-completion/bash/hleb2bash.sh
```

After adding, restart the terminal or run source ~/.bashrc to apply the changes. Autocompletion will work for all projects based on the HLEB2 framework.

### macOS

On macOS, the process is similar. You need to add the line to the ~/.bash_profile or ~/.bashrc file, depending on your terminal setup. For example:

```bash
source /Users/user/web/hleb/vendor/phphleb/cli-completion/bash/hleb2bash.sh
```

Afterward, restart the terminal or run source ~/.bash_profile or source ~/.bashrc to apply the changes. Autocompletion will be available for all HLEB2-based projects.

## Windows

### PowerShell

On Windows, the PowerShell shell is used.

💾 Script file `/windows/hleb2completion.ps1`

Open the user profile:

```bash
notepad $PROFILE
```

A file will open in Notepad. (!) If you get an error that the file was not found, create it and then open it again with the previous command:

```bash
New-Item -ItemType File -Path $PROFILE -Force
```

Now you need to add the path to the executable script in the opened file (specify the actual path):

```text
. "C:\Users\user\web\hleb\vendor\phphleb\cli-completion\windows\hleb2completion.ps1"
```

Restart PowerShell.