<commit_before># Hostbase Command Line Client

The Hostbase CLI features full-text search (using Elasticsearch/Lucene query syntax) and basic CRUD operations, which accept JSON.

## Installation

1. Download the PHAR:  https://github.com/shift31/hostbase-cli/raw/master/hostbase.phar
2. Move it to /usr/local/sbin and rename it to 'hostbase'

## Configuration

Create /etc/hostbase-cli.config.php

```php
<?php

 return array(
     'baseUrl' => 'http://your.hostbase.server'
 );
 ```

## Usage

### Add a host (raw JSON string)

```bash
hostbase hosts -a '{"fqdn": "hostname.domain.tld", "fooKey": "barValue"}' hostname.domain.tld
```

### Add a host (.json file using Bash subshell)

host.json:

```json
{
    "fqdn": "hostname.example.com",
    "fooKey": "barValue"
}
```

```bash
hostbase hosts -a "$(cat host.json)" hostname.example.com
```

### Find a host by FQDN

```bash
hostbase hosts hostname.example.com
```

### Search for a host

#### Example where 'domain' contains 'example.com':

    ```bash
    hostbase hosts -s 'domain:example.com'
    ```

#### Show all host data (output Yaml)

    ```bash
    hostbase hosts -sx 'domain:example.com'
    ```


### Delete a host

```bash
hostbase hosts -d hostname.example.com
```<commit_msg>updating README<commit_after># Hostbase Command Line Client

The Hostbase CLI features full-text search (using Elasticsearch/Lucene query syntax) and basic CRUD operations, which accept JSON.

## Installation

1. Download the PHAR:  https://github.com/shift31/hostbase-cli/raw/master/hostbase.phar
2. Move it to /usr/local/sbin and rename it to 'hostbase'

## Configuration

Create /etc/hostbase-cli.config.php

```php
<?php

 return array(
     'baseUrl' => 'http://your.hostbase.server'
 );
 ```

## Usage

### Add a host (raw JSON string)

```bash
hostbase hosts -a '{"fqdn": "hostname.domain.tld", "fooKey": "barValue"}' hostname.domain.tld
```

### Add a host (.json file using Bash subshell)

host.json:

```json
{
    "fqdn": "hostname.example.com",
    "fooKey": "barValue"
}
```

```bash
hostbase hosts -a "$(cat host.json)" hostname.example.com
```

### Find a host by FQDN

```bash
hostbase hosts hostname.example.com
```

### Search for a host

#### Example where 'domain' contains 'example.com':

```bash
hostbase hosts -s 'domain:example.com'
```

#### Show all host data (output Yaml)

```bash
hostbase hosts -sx 'domain:example.com'
```


### Delete a host

```bash
hostbase hosts -d hostname.example.com
```
{'fraction_non_alphanumeric': 0.16275303643724695, 'fraction_numerical': 0.0032388663967611335, 'mean_word_length': 3.9223107569721116, 'pattern_counts': {'":': 8, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2689118', 'n_tokens_mistral': 888, 'n_tokens_neox': 835, 'n_words': 253}