mirror of
https://codeberg.org/scip/esctl.git
synced 2026-08-24 05:04:18 +02:00
add command tree
This commit is contained in:
62
README.md
62
README.md
@@ -6,30 +6,46 @@ Elasticsearch CLI
|
||||
|
||||
## Usage
|
||||
|
||||
Command tree
|
||||
|
||||
```console
|
||||
NAME:
|
||||
esctl - manage elasticsearch from cli
|
||||
|
||||
USAGE:
|
||||
esctl [global options] [command [command options]]
|
||||
|
||||
VERSION:
|
||||
v0.0.4
|
||||
|
||||
COMMANDS:
|
||||
search, / search within an index
|
||||
index, i manage indicies
|
||||
snapshot, snap manage snapshots
|
||||
cluster, c manage cluster[s]
|
||||
node, snap manage nodes
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
GLOBAL OPTIONS:
|
||||
--debug, -d enable debugging [$ES_DEBUG]
|
||||
--config string, -c string config file [$ES_CONFIG]
|
||||
--cluster string, -C string cluster alias to work with
|
||||
--help, -h show help
|
||||
--version, -v print the version
|
||||
ccr
|
||||
follower
|
||||
add
|
||||
delete
|
||||
pause
|
||||
renew
|
||||
resume
|
||||
show
|
||||
unfollow
|
||||
info
|
||||
pause
|
||||
resume
|
||||
status
|
||||
cluster
|
||||
list
|
||||
settings
|
||||
list
|
||||
set
|
||||
status
|
||||
doc
|
||||
add
|
||||
help
|
||||
index
|
||||
allocation
|
||||
close
|
||||
create
|
||||
delete
|
||||
list
|
||||
show
|
||||
node
|
||||
list
|
||||
show
|
||||
repl
|
||||
search
|
||||
snapshot
|
||||
list
|
||||
show
|
||||
```
|
||||
|
||||
Configure `esctl` with environment variables:
|
||||
|
||||
31
commandtree.sh
Executable file
31
commandtree.sh
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
getcommands() {
|
||||
local command
|
||||
command="$*"
|
||||
|
||||
if ! test "$command" = "help"; then
|
||||
./esctl $command -h | sed -e '/^COMMANDS:/,/^$/!d;//d' -e 's/^ //' -e 's/[, ].*//' | sort
|
||||
fi
|
||||
}
|
||||
|
||||
printcommands() {
|
||||
local indent basecommand commands command
|
||||
indent="$1"
|
||||
basecommand="$2"
|
||||
commands="$3"
|
||||
|
||||
for command in $commands; do
|
||||
echo "$indent" "$command"
|
||||
|
||||
commands=$(getcommands $basecommand $command)
|
||||
|
||||
if test -n "$commands"; then
|
||||
printcommands "${indent} " "$basecommand $command" "$commands"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
commands=$(getcommands "")
|
||||
printcommands "" "" "$commands"
|
||||
Reference in New Issue
Block a user