mirror of
https://github.com/ceph/ceph
synced 2025-01-02 17:12:31 +00:00
rbd: print long aliases specs shorter in help output
(by substituting the common part with '...') Signed-off-by: Mykola Golub <mgolub@suse.com>
This commit is contained in:
parent
f9c7920f57
commit
243a159351
@ -5,132 +5,123 @@
|
||||
|
||||
Positional arguments:
|
||||
<command>
|
||||
bench Simple benchmark.
|
||||
children Display children of snapshot.
|
||||
clone Clone a snapshot into a CoW child
|
||||
image.
|
||||
config image get Get an image-level configuration
|
||||
override.
|
||||
config image list (config image ls) List image-level configuration
|
||||
overrides.
|
||||
config image remove (config image rm) Remove an image-level configuration
|
||||
override.
|
||||
config image set Set an image-level configuration
|
||||
override.
|
||||
config pool get Get a pool-level configuration
|
||||
override.
|
||||
config pool list (config pool ls) List pool-level configuration
|
||||
overrides.
|
||||
config pool remove (config pool rm) Remove a pool-level configuration
|
||||
override.
|
||||
config pool set Set a pool-level configuration
|
||||
override.
|
||||
copy (cp) Copy src image to dest.
|
||||
create Create an empty image.
|
||||
deep copy (deep cp) Deep copy src image to dest.
|
||||
device list (showmapped) List mapped rbd images.
|
||||
device map (map) Map an image to a block device.
|
||||
device unmap (unmap) Unmap a rbd device.
|
||||
diff Print extents that differ since a
|
||||
previous snap, or image creation.
|
||||
disk-usage (du) Show disk usage stats for pool, image
|
||||
or snapshot.
|
||||
export Export image to file.
|
||||
export-diff Export incremental diff to file.
|
||||
feature disable Disable the specified image feature.
|
||||
feature enable Enable the specified image feature.
|
||||
flatten Fill clone with parent data (make it
|
||||
independent).
|
||||
group create Create a group.
|
||||
group image add Add an image to a group.
|
||||
group image list (group image ls) List images in a group.
|
||||
group image remove (group image rm) Remove an image from a group.
|
||||
group list (group ls) List rbd groups.
|
||||
group remove (group rm) Delete a group.
|
||||
group rename Rename a group within pool.
|
||||
group snap create Make a snapshot of a group.
|
||||
group snap list (group snap ls) List snapshots of a group.
|
||||
group snap remove (group snap rm) Remove a snapshot from a group.
|
||||
group snap rename Rename group's snapshot.
|
||||
group snap rollback Rollback group to snapshot.
|
||||
image-meta get Image metadata get the value
|
||||
associated with the key.
|
||||
image-meta list (image-meta ls) Image metadata list keys with values.
|
||||
image-meta remove (image-meta rm) Image metadata remove the key and
|
||||
value associated.
|
||||
image-meta set Image metadata set key with value.
|
||||
import Import image from file.
|
||||
import-diff Import an incremental diff.
|
||||
info Show information about image size,
|
||||
striping, etc.
|
||||
journal client disconnect Flag image journal client as
|
||||
disconnected.
|
||||
journal export Export image journal.
|
||||
journal import Import image journal.
|
||||
journal info Show information about image journal.
|
||||
journal inspect Inspect image journal for structural
|
||||
errors.
|
||||
journal reset Reset image journal.
|
||||
journal status Show status of image journal.
|
||||
list (ls) List rbd images.
|
||||
lock add Take a lock on an image.
|
||||
lock list (lock ls) Show locks held on an image.
|
||||
lock remove (lock rm) Release a lock on an image.
|
||||
merge-diff Merge two diff exports together.
|
||||
migration abort Cancel interrupted image migration.
|
||||
migration commit Commit image migration.
|
||||
migration execute Execute image migration.
|
||||
migration prepare Prepare image migration.
|
||||
mirror image demote Demote an image to non-primary for
|
||||
RBD mirroring.
|
||||
mirror image disable Disable RBD mirroring for an image.
|
||||
mirror image enable Enable RBD mirroring for an image.
|
||||
mirror image promote Promote an image to primary for RBD
|
||||
mirroring.
|
||||
mirror image resync Force resync to primary image for RBD
|
||||
mirroring.
|
||||
mirror image status Show RBD mirroring status for an
|
||||
image.
|
||||
mirror pool demote Demote all primary images in the pool.
|
||||
mirror pool disable Disable RBD mirroring by default
|
||||
within a pool.
|
||||
mirror pool enable Enable RBD mirroring by default
|
||||
within a pool.
|
||||
mirror pool info Show information about the pool
|
||||
mirroring configuration.
|
||||
mirror pool peer add Add a mirroring peer to a pool.
|
||||
mirror pool peer remove Remove a mirroring peer from a pool.
|
||||
mirror pool peer set Update mirroring peer settings.
|
||||
mirror pool promote Promote all non-primary images in the
|
||||
pool.
|
||||
mirror pool status Show status for all mirrored images
|
||||
in the pool.
|
||||
namespace create Create an RBD image namespace.
|
||||
namespace list (namespace ls) List RBD image namespaces.
|
||||
namespace remove (namespace rm) Remove an RBD image namespace.
|
||||
object-map check Verify the object map is correct.
|
||||
object-map rebuild Rebuild an invalid object map.
|
||||
pool init Initialize pool for use by RBD.
|
||||
remove (rm) Delete an image.
|
||||
rename (mv) Rename image within pool.
|
||||
resize Resize (expand or shrink) image.
|
||||
snap create (snap add) Create a snapshot.
|
||||
snap limit clear Remove snapshot limit.
|
||||
snap limit set Limit the number of snapshots.
|
||||
snap list (snap ls) Dump list of image snapshots.
|
||||
snap protect Prevent a snapshot from being deleted.
|
||||
snap purge Delete all unprotected snapshots.
|
||||
snap remove (snap rm) Delete a snapshot.
|
||||
snap rename Rename a snapshot.
|
||||
snap rollback (snap revert) Rollback image to snapshot.
|
||||
snap unprotect Allow a snapshot to be deleted.
|
||||
status Show the status of this image.
|
||||
trash list (trash ls) List trash images.
|
||||
trash move (trash mv) Move an image to the trash.
|
||||
trash purge Remove all expired images from trash.
|
||||
trash remove (trash rm) Remove an image from trash.
|
||||
trash restore Restore an image from trash.
|
||||
watch Watch events on image.
|
||||
bench Simple benchmark.
|
||||
children Display children of snapshot.
|
||||
clone Clone a snapshot into a CoW child image.
|
||||
config image get Get an image-level configuration override.
|
||||
config image list (... ls) List image-level configuration overrides.
|
||||
config image remove (... rm) Remove an image-level configuration
|
||||
override.
|
||||
config image set Set an image-level configuration override.
|
||||
config pool get Get a pool-level configuration override.
|
||||
config pool list (... ls) List pool-level configuration overrides.
|
||||
config pool remove (... rm) Remove a pool-level configuration
|
||||
override.
|
||||
config pool set Set a pool-level configuration override.
|
||||
copy (cp) Copy src image to dest.
|
||||
create Create an empty image.
|
||||
deep copy (deep cp) Deep copy src image to dest.
|
||||
device list (showmapped) List mapped rbd images.
|
||||
device map (map) Map an image to a block device.
|
||||
device unmap (unmap) Unmap a rbd device.
|
||||
diff Print extents that differ since a
|
||||
previous snap, or image creation.
|
||||
disk-usage (du) Show disk usage stats for pool, image or
|
||||
snapshot.
|
||||
export Export image to file.
|
||||
export-diff Export incremental diff to file.
|
||||
feature disable Disable the specified image feature.
|
||||
feature enable Enable the specified image feature.
|
||||
flatten Fill clone with parent data (make it
|
||||
independent).
|
||||
group create Create a group.
|
||||
group image add Add an image to a group.
|
||||
group image list (... ls) List images in a group.
|
||||
group image remove (... rm) Remove an image from a group.
|
||||
group list (group ls) List rbd groups.
|
||||
group remove (group rm) Delete a group.
|
||||
group rename Rename a group within pool.
|
||||
group snap create Make a snapshot of a group.
|
||||
group snap list (... ls) List snapshots of a group.
|
||||
group snap remove (... rm) Remove a snapshot from a group.
|
||||
group snap rename Rename group's snapshot.
|
||||
group snap rollback Rollback group to snapshot.
|
||||
image-meta get Image metadata get the value associated
|
||||
with the key.
|
||||
image-meta list (image-meta ls) Image metadata list keys with values.
|
||||
image-meta remove (image-meta rm) Image metadata remove the key and value
|
||||
associated.
|
||||
image-meta set Image metadata set key with value.
|
||||
import Import image from file.
|
||||
import-diff Import an incremental diff.
|
||||
info Show information about image size,
|
||||
striping, etc.
|
||||
journal client disconnect Flag image journal client as disconnected.
|
||||
journal export Export image journal.
|
||||
journal import Import image journal.
|
||||
journal info Show information about image journal.
|
||||
journal inspect Inspect image journal for structural
|
||||
errors.
|
||||
journal reset Reset image journal.
|
||||
journal status Show status of image journal.
|
||||
list (ls) List rbd images.
|
||||
lock add Take a lock on an image.
|
||||
lock list (lock ls) Show locks held on an image.
|
||||
lock remove (lock rm) Release a lock on an image.
|
||||
merge-diff Merge two diff exports together.
|
||||
migration abort Cancel interrupted image migration.
|
||||
migration commit Commit image migration.
|
||||
migration execute Execute image migration.
|
||||
migration prepare Prepare image migration.
|
||||
mirror image demote Demote an image to non-primary for RBD
|
||||
mirroring.
|
||||
mirror image disable Disable RBD mirroring for an image.
|
||||
mirror image enable Enable RBD mirroring for an image.
|
||||
mirror image promote Promote an image to primary for RBD
|
||||
mirroring.
|
||||
mirror image resync Force resync to primary image for RBD
|
||||
mirroring.
|
||||
mirror image status Show RBD mirroring status for an image.
|
||||
mirror pool demote Demote all primary images in the pool.
|
||||
mirror pool disable Disable RBD mirroring by default within a
|
||||
pool.
|
||||
mirror pool enable Enable RBD mirroring by default within a
|
||||
pool.
|
||||
mirror pool info Show information about the pool mirroring
|
||||
configuration.
|
||||
mirror pool peer add Add a mirroring peer to a pool.
|
||||
mirror pool peer remove Remove a mirroring peer from a pool.
|
||||
mirror pool peer set Update mirroring peer settings.
|
||||
mirror pool promote Promote all non-primary images in the
|
||||
pool.
|
||||
mirror pool status Show status for all mirrored images in
|
||||
the pool.
|
||||
namespace create Create an RBD image namespace.
|
||||
namespace list (namespace ls) List RBD image namespaces.
|
||||
namespace remove (namespace rm) Remove an RBD image namespace.
|
||||
object-map check Verify the object map is correct.
|
||||
object-map rebuild Rebuild an invalid object map.
|
||||
pool init Initialize pool for use by RBD.
|
||||
remove (rm) Delete an image.
|
||||
rename (mv) Rename image within pool.
|
||||
resize Resize (expand or shrink) image.
|
||||
snap create (snap add) Create a snapshot.
|
||||
snap limit clear Remove snapshot limit.
|
||||
snap limit set Limit the number of snapshots.
|
||||
snap list (snap ls) Dump list of image snapshots.
|
||||
snap protect Prevent a snapshot from being deleted.
|
||||
snap purge Delete all unprotected snapshots.
|
||||
snap remove (snap rm) Delete a snapshot.
|
||||
snap rename Rename a snapshot.
|
||||
snap rollback (snap revert) Rollback image to snapshot.
|
||||
snap unprotect Allow a snapshot to be deleted.
|
||||
status Show the status of this image.
|
||||
trash list (trash ls) List trash images.
|
||||
trash move (trash mv) Move an image to the trash.
|
||||
trash purge Remove all expired images from trash.
|
||||
trash remove (trash rm) Remove an image from trash.
|
||||
trash restore Restore an image from trash.
|
||||
watch Watch events on image.
|
||||
|
||||
Optional arguments:
|
||||
-c [ --conf ] arg path to cluster configuration
|
||||
|
@ -20,7 +20,7 @@ public:
|
||||
|
||||
static const size_t LINE_WIDTH = 80;
|
||||
static const size_t MIN_NAME_WIDTH = 20;
|
||||
static const size_t MAX_DESCRIPTION_OFFSET = LINE_WIDTH / 2 + 2;
|
||||
static const size_t MAX_DESCRIPTION_OFFSET = LINE_WIDTH / 2;
|
||||
|
||||
OptionPrinter(const OptionsDescription &positional,
|
||||
const OptionsDescription &optional);
|
||||
|
@ -63,11 +63,31 @@ std::string format_command_spec(const Shell::CommandSpec &spec) {
|
||||
return joinify<std::string>(spec.begin(), spec.end(), " ");
|
||||
}
|
||||
|
||||
std::string format_alias_spec(const Shell::CommandSpec &spec,
|
||||
const Shell::CommandSpec &alias_spec) {
|
||||
auto spec_it = spec.begin();
|
||||
auto alias_it = alias_spec.begin();
|
||||
int level = 0;
|
||||
while (spec_it != spec.end() && alias_it != alias_spec.end() &&
|
||||
*spec_it == *alias_it) {
|
||||
spec_it++;
|
||||
alias_it++;
|
||||
level++;
|
||||
}
|
||||
ceph_assert(spec_it != spec.end() && alias_it != alias_spec.end());
|
||||
|
||||
if (level < 2) {
|
||||
return joinify<std::string>(alias_spec.begin(), alias_spec.end(), " ");
|
||||
} else {
|
||||
return "... " + joinify<std::string>(alias_it, alias_spec.end(), " ");
|
||||
}
|
||||
}
|
||||
|
||||
std::string format_command_name(const Shell::CommandSpec &spec,
|
||||
const Shell::CommandSpec &alias_spec) {
|
||||
std::string name = format_command_spec(spec);
|
||||
if (!alias_spec.empty()) {
|
||||
name += " (" + format_command_spec(alias_spec) + ")";
|
||||
name += " (" + format_alias_spec(spec, alias_spec) + ")";
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user