From 20a119eb4a4c4f547626809b8a030820de6c5470 Mon Sep 17 00:00:00 2001 From: Alex Aizman Date: Tue, 28 Jan 2025 15:06:08 -0500 Subject: [PATCH] CLI: sort top-level commands * ais Signed-off-by: Alex Aizman --- README.md | 12 +++++++----- cmd/cli/cli/app.go | 7 +++++++ docs/cli.md | 11 ++++++----- docs/index.md | 13 ++++++++----- 4 files changed, 28 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index fe51332350..80af92e900 100644 --- a/README.md +++ b/README.md @@ -27,14 +27,16 @@ AIS [consistently shows balanced I/O distribution and linear scalability](https: For easy usage, management, and monitoring, there's also: * **Integrated easy-to-use [CLI](/docs/cli.md)**, with top-level commands including: + ```console $ ais -bucket job storage remote-cluster download create wait -object auth archive alias get evict cp -cluster show log rmo dsort stop ls -config help tls space-cleanup put scrub prefetch -etl advanced performance blob-download rmb start search +advanced cluster etl ls rmb stop +alias config evict object rmo storage +archive cp get performance scrub tls +auth create help prefetch show wait +blob-download download job put space-cleanup search +bucket dsort log remote-cluster start ``` AIS runs natively on Kubernetes and features open format - thus, the freedom to copy or move your data from AIS at any time using the familiar Linux `tar(1)`, `scp(1)`, `rsync(1)` and similar. diff --git a/cmd/cli/cli/app.go b/cmd/cli/cli/app.go index 00f9b01eee..aca2942d55 100644 --- a/cmd/cli/cli/app.go +++ b/cmd/cli/cli/app.go @@ -10,6 +10,7 @@ import ( "os" "os/exec" "path/filepath" + "sort" "strings" "sync" "time" @@ -330,6 +331,12 @@ func (a *acli) setupCommands(emptyCmdline bool) { } app.Commands = append(app.Commands, a.initAliases()...) + + // alphabetically + sort.Slice(app.Commands, func(i, j int) bool { + return app.Commands[i].Name < app.Commands[j].Name + }) + setupCommandHelp(app.Commands) a.enableSearch() } diff --git a/docs/cli.md b/docs/cli.md index 4040b013b2..1a493f2180 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -115,11 +115,12 @@ The recommended and, actually, fastest way to get started with CLI is to type `a ```console $ ais -bucket job storage remote-cluster download create wait -object auth archive alias get evict cp -cluster show log rmo dsort stop ls -config help tls space-cleanup put scrub prefetch -etl advanced performance blob-download rmb start search +advanced cluster etl ls rmb stop +alias config evict object rmo storage +archive cp get performance scrub tls +auth create help prefetch show wait +blob-download download job put space-cleanup search +bucket dsort log remote-cluster start ``` These are the current set of top-level commands. Each command has its own extended help (the `--help` option) and, usually, multiple sub-commands diff --git a/docs/index.md b/docs/index.md index bb6b74c940..dbf4ebbb61 100644 --- a/docs/index.md +++ b/docs/index.md @@ -36,14 +36,17 @@ AIS [consistently shows balanced I/O distribution and linear scalability](https: For easy usage, management, and monitoring, there's also: * **Integrated easy-to-use [CLI](/docs/cli.md)**, with top-level commands including: + + ```console $ ais -bucket job storage remote-cluster download create wait -object auth archive alias get evict cp -cluster show log rmo dsort stop ls -config help tls space-cleanup put scrub prefetch -etl advanced performance blob-download rmb start search +advanced cluster etl ls rmb stop +alias config evict object rmo storage +archive cp get performance scrub tls +auth create help prefetch show wait +blob-download download job put space-cleanup search +bucket dsort log remote-cluster start ``` AIS runs natively on Kubernetes and features open format - thus, the freedom to copy or move your data from AIS at any time using the familiar Linux `tar(1)`, `scp(1)`, `rsync(1)` and similar.