improved usage and added utility to generate markdown docs
This commit is contained in:
parent
c87cf35ace
commit
81e676de79
|
@ -28,7 +28,7 @@ var batchSize int
|
|||
|
||||
// bulkCmd represents the bulk command
|
||||
var bulkCmd = &cobra.Command{
|
||||
Use: "bulk",
|
||||
Use: "bulk [index path] [data paths ...]",
|
||||
Short: "bulk loads from newline delimited JSON files",
|
||||
Long: `The bulk command will perform batch loading of documents in one or more newline delimited JSON files.`,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
|
|
@ -22,7 +22,7 @@ import (
|
|||
|
||||
// countCmd represents the count command
|
||||
var countCmd = &cobra.Command{
|
||||
Use: "count",
|
||||
Use: "count [index path]",
|
||||
Short: "counts the number documents in the index",
|
||||
Long: `The count command will count the number of documents in the index.`,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
|
|
@ -27,7 +27,7 @@ var mappingPath, indexType, storeType string
|
|||
|
||||
// createCmd represents the create command
|
||||
var createCmd = &cobra.Command{
|
||||
Use: "create",
|
||||
Use: "create [index path]",
|
||||
Short: "creates a new index",
|
||||
Long: `The create command will create a new empty index.`,
|
||||
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
|
|
@ -22,7 +22,7 @@ import (
|
|||
|
||||
// dictionaryCmd represents the dictionary command
|
||||
var dictionaryCmd = &cobra.Command{
|
||||
Use: "dictionary",
|
||||
Use: "dictionary [index path] [field name]",
|
||||
Short: "prints the term dictionary for the specified field in the index",
|
||||
Long: `The dictionary command will print the term dictionary for the specified field.`,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
|
|
@ -25,7 +25,7 @@ var docID string
|
|||
|
||||
// dumpCmd represents the dump command
|
||||
var dumpCmd = &cobra.Command{
|
||||
Use: "dump",
|
||||
Use: "dump [index path]",
|
||||
Short: "dumps the contents of the index",
|
||||
Long: `The dump command will dump (possibly a section of) the index.`,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
|
|
@ -23,7 +23,7 @@ import (
|
|||
|
||||
// dumpDocCmd represents the dumpDoc command
|
||||
var dumpDocCmd = &cobra.Command{
|
||||
Use: "doc",
|
||||
Use: "doc [index path] [doc id]",
|
||||
Short: "dump only the rows relating to this doc ID",
|
||||
Long: `The doc sub-command of dump will only dump the rows relating to this doc ID.`,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
|
|
@ -23,7 +23,7 @@ import (
|
|||
|
||||
// dumpFieldsCmd represents the dumpFields command
|
||||
var dumpFieldsCmd = &cobra.Command{
|
||||
Use: "fields",
|
||||
Use: "fields [index path]",
|
||||
Short: "dump only the field rows",
|
||||
Long: `The fields sub-command of dump will only dump the field rows.`,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
|
|
@ -22,7 +22,7 @@ import (
|
|||
|
||||
// fieldsCmd represents the fields command
|
||||
var fieldsCmd = &cobra.Command{
|
||||
Use: "fields",
|
||||
Use: "fields [index path]",
|
||||
Short: "lists the fields in this index",
|
||||
Long: `The fields command will list the fields used in this index.`,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
|
|
@ -29,7 +29,7 @@ var keepDir, keepExt, parseJSON bool
|
|||
|
||||
// indexCmd represents the index command
|
||||
var indexCmd = &cobra.Command{
|
||||
Use: "index",
|
||||
Use: "index [index path] [data paths ...]",
|
||||
Short: "adds the files to the index",
|
||||
Long: `The index command adds the specified files to the index.`,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
|
|
@ -24,7 +24,7 @@ import (
|
|||
|
||||
// mappingCmd represents the mapping command
|
||||
var mappingCmd = &cobra.Command{
|
||||
Use: "mapping",
|
||||
Use: "mapping [index path]",
|
||||
Short: "prints the mapping used for this index",
|
||||
Long: `The mapping command prints a JSON represenation of the mapping used for this index.`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
|
|
|
@ -28,7 +28,7 @@ var qtype, qfield string
|
|||
|
||||
// queryCmd represents the query command
|
||||
var queryCmd = &cobra.Command{
|
||||
Use: "query",
|
||||
Use: "query [index path] [query]",
|
||||
Short: "queries the index",
|
||||
Long: `The query command will execute a query against the index.`,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/blevesearch/bleve/cmd/bleve/cmd"
|
||||
|
||||
"github.com/spf13/cobra/doc"
|
||||
)
|
||||
|
||||
// you can generate markdown docs by running
|
||||
//
|
||||
// $ go run gendocs.go
|
||||
//
|
||||
// this also requires doc sub-package of cobra
|
||||
// which is not kept in this repo
|
||||
// you can acquire it by running
|
||||
//
|
||||
// $ gvt restore
|
||||
|
||||
func main() {
|
||||
cmd.RootCmd.DisableAutoGenTag = true
|
||||
doc.GenMarkdownTree(cmd.RootCmd, "./")
|
||||
}
|
Loading…
Reference in New Issue