From 8561f73bc47e0145cdff2396b7c325c0e4403dfb Mon Sep 17 00:00:00 2001 From: Alexandru Claudius Virtopeanu Date: Fri, 24 Nov 2023 13:55:15 +0200 Subject: [PATCH] doc: Readme --- README.md | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index c7178b9..33704e8 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,28 @@ # Cobra-Prompt Plus (Comptplus) -Comptplus is a fork of [Cobra Prompt](https://github.com/stromland/cobra-prompt) with added features: - - Automatic Flag Value Completion: Extracts possible flag values and recommends them to the user. - - Works with descriptions registered via `RegisterFlagCompletionFunc` - - This is only possible with Cobra 1.8.0 (specifically PRs [spf13/cobra#1943](https://github.com/spf13/cobra/pull/1943) and [spf13/cobra#2063](https://github.com/spf13/cobra/pull/2063)) - - Flag descriptions are also added correctly (in Cobra `\t` is used to split the flag values vs. flag descriptions). - ![image](https://github.com/avirtopeanu-ionos/cobra-prompt/assets/100703584/9a4b23f1-5f7e-4e76-89f3-010a799158f5) - - `HookBefore` and `HookAfter` custom hooks which can be used to specify custom behaviour before/after each command - - Refactor to use some stateless funcs +![Comptplus Banner](https://github.com/avirtopeanu-ionos/cobra-prompt/assets/100703584/9a4b23f1-5f7e-4e76-89f3-010a799158f5) + +> Comptplus is a fork of [Cobra Prompt](https://github.com/stromland/cobra-prompt) with added features, intended to enhance the original implementation by making it more versatile. + +## Projects using this fork +- [Ionos Cloud CLI](https://github.com/ionos-cloud/ionosctl/) + +## Features unique to this fork +### Flag Value Completions and Persistence +- **Flag Completions**: Added completions for flag values, facilitating easier and more intuitive command usage. + - Default cache duration for responses is set to 500ms, reducing latency in user interaction. + - Support for flag descriptions by splitting on `\t`. + +### Customizable Flag Reset Behaviors +- **Custom Flag Reset Behaviors**: Ability to set custom behaviors for resetting flag values. + - The default flag reset behaviour has also been changed to reset flags to their default values after each command execution, improving consistency and predictability of the shell environment. + - A bug in the original repo caused slice/array flags to be reset incorrectly, by appending the default values to the previous execution's values. This has been fixed in this fork. + +### Pre and Post Execution Hooks +- **Execution Hooks**: Added `HookBefore` and `HookAfter` for performing actions before and after command execution. + +### Enhanced Flag Persistence +- **Persist Flag Values**: Refined behavior of `PersistFlagValues` to offer more seamless flag value persistence across shell sessions. ## Original README below