Skip to content

Commit

Permalink
doc: Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
avirtopeanu-ionos committed Nov 24, 2023
1 parent 23ae6fb commit 8561f73
Showing 1 changed file with 23 additions and 8 deletions.
31 changes: 23 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit 8561f73

Please sign in to comment.