hive-cli 0.1.1

A fast and minimal wrapper for the nix package manager
![Hive Banner](./assets/banner.png)

# Hive CLI Documentation

**Hive** is a command-line tool designed for managing Nix packages easily. It provides commands to install, uninstall, and interact with packages in a Nix shell. This document outlines the installation process and usage details for Hive.

## Installation Instructions

To install Hive, you need to have Rust and Cargo installed on your system, as Hive is built using Rust. Follow these steps to get Hive up and running:

### Prerequisites

1. **Install Rust**: If you haven't already installed Rust, you can do so using `rustup`. Open your terminal and run:

   ```sh
   curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
   ```

<br>

Follow the on-screen instructions to complete the installation. You might need to restart your terminal or run `source $HOME/.cargo/env` to start using Rust immediately.

2. **Verify Installation**: Ensure Rust and Cargo are installed correctly by running:

   ```sh
   rustc --version
   cargo --version
   ```

### Clone and Build Hive

1. **Clone the Repository**: Clone the Hive repository from GitHub:

   ```sh
   git clone https://github.com/HivewareOS/hive.git
   ```

<br>

2. **Navigate to the Project Directory**: Move into the cloned repository directory:

   ```sh
   cd hive
   ```

<br>

3. **Build the Project**: Compile the Hive tool using Cargo:

   ```sh
   cargo build --release
   ```

   The compiled binary will be located in the `target/release` directory.

<br>

4. **Install the Binary**: Optionally, you can copy the binary to a directory in your system's PATH for easy execution. For example:

   ```sh
   cp target/release/hive /usr/local/bin/
   ```

   Ensure `/usr/local/bin` is in your PATH. You might need `sudo` permissions to copy the binary.

<br>

5. To add the Cargo bin directory to your PATH, append the following line to your .bashrc, .zshrc, or equivalent shell configuration file:

```bash
export PATH="$HOME/.cargo/bin:$PATH"
```

After updating the file, reload your shell configuration with:

```bash
source ~/.bashrc
```

or

```bash
source ~/.zshrc
```

## Usage

Once Hive is installed, you can use it to manage Nix packages. Here’s a quick guide to the available commands:

### Commands Overview

#### `install`

Installs a package using `nix-env`.

**Usage:**

```sh
hive install <package>
```

- **`<package>`**: The name of the package to install.

**Example:**

```sh
hive install rust-analyzer
```

#### `uninstall`

Uninstalls a package using `nix-env`.

**Usage:**

```sh
hive uninstall <package>
```

- **`<package>`**: The name of the package to uninstall.

**Example:**

```sh
hive uninstall wezterm
```

#### `virtual`

Enters a Nix shell with a specified package installed.

**Usage:**

```sh
hive virtual <package>
```

- **`<package>`**: The name of the package to install in the Nix shell.

**Example:**

```sh
hive virtual alacritty
```

#### `version`

Displays the current version of Hive.

**Usage:**

```sh
hive version
```

**Example:**

```sh
hive version
```

## Error Handling

If an invalid command or option is provided, Hive will display an error message and exit with status code `1`.

## Contact and Support

For support or inquiries, please contact HivewareOS at [hiveware@protonmail.com](mailto:hiveware@protonmail.com).

## Additional Information

For more detailed information on usage and options, use:

```sh
hive --help
```

---

This documentation aims to provide a comprehensive overview of installing and using Hive. If you encounter any issues or have questions, don't hesitate to reach out for support.