Skip to content

Commit

Permalink
add help text and fill out readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesse Schmidt committed Jun 4, 2024
1 parent d8fede7 commit 4795b13
Show file tree
Hide file tree
Showing 9 changed files with 98 additions and 57 deletions.
45 changes: 43 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,43 @@
# asvec
Aerospike Vector CLI
# Aerospike Vector Search CLI Tool

## Overview

The Aerospike Vector Search (AVS) CLI Tool is designed to simplify the
management of AVS deployments. It offers a features aimed at enhancing
efficiency and productivity for users getting started with vector search.

## Getting Started

### Prerequisites

Ensure you have an AVS instance up and running for `asvec` to connect to.
Checkout out the [AVS documentation](https://aerospike.com/docs/vector) for
options on getting started.

### Installation

Download the latest release from [GitHub Releases](https://github.com/aerospike/asvec/releases).

### Basic Usage

To verify the installation and view available commands, execute:
```bash
asvec --help
```

## Features

> [!NOTE]
> More features are in the works. Don't worry!
- **Index Management**: Streamline the management of AVS deployments.

## Issues

If you encounter an issue feel free to open a GitHub issue or discussion.
Otherwise, if you are an enterprise customer, please [contact support](https://aerospike.com/support/)


## License

This project is licensed under the MIT License. See the [LICENSE.md](LICENSE.md) file for details.
13 changes: 6 additions & 7 deletions cmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ import (
// createCmd represents the create command
var createCmd = &cobra.Command{
Use: "create",
Short: "A brief description of your command",
Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command. For example:
Cobra is a CLI library for Go that empowers applications.
This application is a tool to generate the needed files
to quickly create a Cobra application.`,
Short: "A parent command for creating resources",
Long: `A parent command for creating resources. It currently only supports creating indexes.
For example:
export ASVEC_HOST=<avs-ip>:5000
asvec create index -i myindex -n test -s testset -f vector-field -d 256 -m COSINE
`,
}

func init() {
Expand Down
19 changes: 12 additions & 7 deletions cmd/createIndex.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,18 @@ var createIndexRequiredFlags = []string{
func newCreateIndexCmd() *cobra.Command {
return &cobra.Command{
Use: "index",
Short: "A brief description of your command",
Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command. For example:
Cobra is a CLI library for Go that empowers applications.
This application is a tool to generate the needed files
to quickly create a Cobra application.`,
Short: "A command for creating indexes",
Long: `A command for creating indexes. An index is required to enable vector
search on your data. The index tells AVS where your data is located,
what your vectors look like, and how vectors should be compared to each other.
You can optionally tweak where your index is stored, and how the HNSW algorithm
behaves.
For example:
export ASVEC_HOST=<avs-ip>:5000
asvec create index -i myindex -n test -s testset -d 256 -m COSINE --vector-field vector \
--storage-namespace test --hnsw-batch-enabled false
`,
PreRunE: func(_ *cobra.Command, _ []string) error {
if viper.IsSet(flagNameSeeds) && viper.IsSet(flagNameHost) {
return fmt.Errorf("only --%s or --%s allowed", flagNameSeeds, flagNameHost)
Expand Down
13 changes: 6 additions & 7 deletions cmd/drop.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ import (
// dropCmd represents the drop command
var dropCmd = &cobra.Command{
Use: "drop",
Short: "A brief description of your command",
Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command. For example:
Cobra is a CLI library for Go that empowers applications.
This application is a tool to generate the needed files
to quickly create a Cobra application.`,
Short: "A parent command for dropping resources",
Long: `A parent command for dropping resources. It currently only supports dropping indexes.
For example:
export ASVEC_HOST=<avs-ip>:5000
asvec drop index -i myindex -n test
`,
}

func init() {
Expand Down
15 changes: 8 additions & 7 deletions cmd/dropIndex.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,14 @@ var dropIndexRequiredFlags = []string{
func newDropIndexCommand() *cobra.Command {
return &cobra.Command{
Use: "index",
Short: "A brief description of your command",
Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command. For example:
Cobra is a CLI library for Go that empowers applications.
This application is a tool to generate the needed files
to quickly create a Cobra application.`,
Short: "A command for dropping indexes",
Long: `A command for dropping indexes. Deleting an index will free up
storage but will also disable vector search on your data.
For example:
export ASVEC_HOST=<avs-ip>:5000
asvec drop index -i myindex -n test
`,
PreRunE: func(_ *cobra.Command, _ []string) error {
if viper.IsSet(flagNameSeeds) && viper.IsSet(flagNameHost) {
return fmt.Errorf("only --%s or --%s allowed", flagNameSeeds, flagNameHost)
Expand Down
5 changes: 4 additions & 1 deletion cmd/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ func parseHostPort(v string) (*avs.HostPort, error) {
var intPort int64

intPort, err = strconv.ParseInt(match, 0, 0)

if err == nil {
host.Port = int(intPort)
}
Expand All @@ -160,6 +159,10 @@ func parseHostPort(v string) (*avs.HostPort, error) {
}
}

if host.Port == 0 {
host.Port = DefaultPort
}

return host, nil
}
}
Expand Down
13 changes: 6 additions & 7 deletions cmd/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ import (
// listCmd represents the list command
var listCmd = &cobra.Command{
Use: "list",
Short: "A brief description of your command",
Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command. For example:
Cobra is a CLI library for Go that empowers applications.
This application is a tool to generate the needed files
to quickly create a Cobra application.`,
Short: "A parent command for listing resources",
Long: `A parent command for listings resources. It currently only supports listing indexes.
For example:
export ASVEC_HOST=<avs-ip>:5000
asvec list index
`,
}

func init() {
Expand Down
19 changes: 8 additions & 11 deletions cmd/listIndex.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,18 @@ func newListIndexFlagSet() *pflag.FlagSet {
return flagSet
}

var listIndexRequiredFlags = []string{
flagNameNamespace,
flagNameIndexName,
}
var listIndexRequiredFlags = []string{}

// listIndexCmd represents the listIndex command
func newListIndexCmd() *cobra.Command {
return &cobra.Command{Use: "index",
Short: "A brief description of your command",
Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command. For example:
Cobra is a CLI library for Go that empowers applications.
This application is a tool to generate the needed files
to quickly create a Cobra application.`,
Short: "A command for listing indexes",
Long: fmt.Sprintf(`A command for displaying useful information about AVS indexes. To display additional
index information use the --%s flag.
For example:
export ASVEC_HOST=<avs-ip>:5000
asvec list index
`, flagNameVerbose),
PreRunE: func(_ *cobra.Command, _ []string) error {
if viper.IsSet(flagNameSeeds) && viper.IsSet(flagNameHost) {
return fmt.Errorf("only --%s or --%s allowed", flagNameSeeds, flagNameHost)
Expand Down
13 changes: 5 additions & 8 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,11 @@ var rootFlags = &struct {
// rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{
Use: "asvec",
Short: "A brief description of your application",
Long: `A longer description that spans multiple lines and likely contains
examples and usage of using your application. For example:
Cobra is a CLI library for Go that empowers applications.
This application is a tool to generate the needed files
to quickly create a Cobra application.`,
Short: "Aerospike Vector Search CLI",
Long: `Welcome to the AVS Deployment Manager CLI Tool!
To start using this tool, please consult the detailed documentation available at https://aerospike.com/docs/vector.
Should you encounter any issues or have questions, feel free to report them via GitHub issues.
Enterprise customers requiring support should contact Aerospike Support directly at https://aerospike.com/support.`,
PersistentPreRunE: func(cmd *cobra.Command, _ []string) error {
if rootFlags.logLevel.NotSet() {
lvl.Set(slog.LevelError + 1) // disable all logging
Expand Down Expand Up @@ -73,7 +71,6 @@ to quickly create a Cobra application.`,
})

return persistedErr

},
}

Expand Down

0 comments on commit 4795b13

Please sign in to comment.