# CLI

> **Note**: *pi* is based on [`kubectl`](https://v1-9.docs.kubernetes.io/docs/reference/kubectl/overview/).

`pi` is a command line interface for running commands against *Pi* cloud. This overview covers `pi` syntax, describes the command operations, and provides common examples.

## Install

We currently provides official CLI builds for Linux and Mac.

* Linux x86

  ```bash
  $ wget https://hyper-install.s3.amazonaws.com/pi.linux-amd64.tar.gz
  $ tar xzf pi.linux-amd64.tar.gz
  $ ./pi
  ```
* Mac OS X 10.7 (lion) or later

  ```
  $ curl -O https://hyper-install.s3.amazonaws.com/pi.darwin-amd64.zip
  $ unzip pi.darwin-amd64.zip
  $ ./pi
  ```

## Configure pi

In order for pi to find and access a Pi regiion, it needs a configuration file, which, by default, is located at `~/.pi/config`.

```bash
//set credentials for user1(alias)
$ pi config set-credentials user1 --region=gcp-us-central1 --access-key="xxx" --secret-key="xxxxxx"

//set another credentials for user2(alias, default region is "gcp-us-central1" )
$ pi config set-credentials user2 --access-key="yyy" --secret-key="yyyyyy"

//select default user
$ pi config set-context default --user=user2

//delete credentials for user1
$ pi config delete-credentials user1

//view config
$ pi config view
apiVersion: v1
clusters:
- cluster:
    insecure-skip-tls-verify: true
    server: https://*.hyper.sh:443
  name: default
contexts:
- context:
    cluster: default
    namespace: default
    user: user2
  name: default
current-context: default
kind: Config
preferences: {}
users:
- name: user2
  user:
    access-key: yyy
    region: gcp-us-central1
    secret-key: yyyyyy


// config file:
$ cat ~/.pi/config
```

## Operations

> Find more information at <https://github.com/hyperhq/pi>.

### Basic Commands (Beginner):

* `create`      Create a resource.

### Basic Commands (Intermediate):

* `get`         Display one or many resources
* `delete`      Delete resources by resources and names
* `run`         Run a pod with particular image.
* `name`        Name a resource

### Troubleshooting and Debugging Commands:

* `describe`    Show details of a specific resource or group of resources
* `logs`        Print the logs for a container in a pod
* `exec`        Execute a command in a container

### Other Commands:

* `config`      Modify pi config files
* `help`        Help about any command
* `info`        Print region and user info

Usage: pi \[flags] \[options]

Use "pi  --help" for more information about a given command. Use "pi options" for a list of global command-line options (applies to all commands).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hyperhq.gitbook.io/pi-docs/reference/cli.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
