Skip to content

Commit

Permalink
update readme and change action name
Browse files Browse the repository at this point in the history
  • Loading branch information
CyrusJavan committed Oct 16, 2020
1 parent 22d6408 commit 4904edd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,25 @@ Required environment variables:
Usage
-

### `avx`
### `avx login`

With no arguments `avx` will attempt to login with the provided credentials. If
`avx login` will attempt to login with the provided credentials. If
successful, the CID will be printed out.
```shell script
$ avx
$ avx login
CID: "MMUyqYcNOjaWUWIFHmYA"
```

---

### `avx <action>`
### `avx rpc <action>`

With a single argument `avx` will attempt to login and send a POST request to
`avx rpc <action>` will attempt to login and send a POST request to
the API with the provided `action`. `avx` prints out debug information like the
controller IP, request body and response latency. `avx` then prints out the
response body.
```shell script
$ avx example_action
$ avx rpc list_accounts
controller IP: 127.0.0.1
request body:
{
Expand All @@ -67,12 +67,12 @@ response body:
---
### `avx <action> <key>=<value> [<key>=<value>...]`
### `avx rpc <action> <key>=<value> [<key>=<value>...]`
In this form `avx` will send a POST request with the given action and any extra
In this form `avx rpc` will send a POST request with the given action and any extra
params that were provided.
```shell script
$ avx delete_account_profile account_name=john-gcloud
$ avx rpc delete_account_profile account_name=john-gcloud
controller IP: 127.0.0.1
request body:
{
Expand Down
10 changes: 5 additions & 5 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ var (
RunE: loginFunc,
}

actionCmd = &cobra.Command{
Use: "action",
rpcCmd = &cobra.Command{
Use: "rpc",
Short: "Make an API call to the controller.",
Args: cobra.MinimumNArgs(1),
RunE: actionFunc,
RunE: rpcFunc,
}
)

Expand All @@ -42,7 +42,7 @@ func Execute() error {
}

func init() {
rootCmd.AddCommand(actionCmd)
rootCmd.AddCommand(rpcCmd)
rootCmd.AddCommand(loginCmd)
}

Expand Down Expand Up @@ -96,7 +96,7 @@ func loginFunc(cmd *cobra.Command, args []string) error {
return nil
}

func actionFunc(cmd *cobra.Command, args []string) error {
func rpcFunc(cmd *cobra.Command, args []string) error {
client, err := getClient()
if err != nil {
return fmt.Errorf("could not get client: %w", err)
Expand Down

0 comments on commit 4904edd

Please sign in to comment.