https://github.com/reeflective/console
Closed-loop application library for Cobra commands (powerful, ready-to-run and easy to use)
https://github.com/reeflective/console
cli cobra command-line console console-application go golang history menus oh-my-posh
Last synced: about 2 months ago
JSON representation
Closed-loop application library for Cobra commands (powerful, ready-to-run and easy to use)
- Host: GitHub
- URL: https://github.com/reeflective/console
- Owner: reeflective
- License: apache-2.0
- Created: 2021-04-03T23:52:58.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2026-01-15T22:00:04.000Z (3 months ago)
- Last Synced: 2026-01-16T01:01:08.321Z (3 months ago)
- Topics: cli, cobra, command-line, console, console-application, go, golang, history, menus, oh-my-posh
- Language: Go
- Homepage:
- Size: 23 MB
- Stars: 100
- Watchers: 5
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- trackawesomelist - console (⭐75) - loop application library for Cobra commands, with oh-my-posh prompts, and more. (Recently Updated / [Dec 04, 2024](/content/2024/12/04/README.md))
- awesome-go - console - loop application library for Cobra commands, with oh-my-posh prompts, and more. (Command Line / Standard CLI)
- awesome-go-with-stars - console - loop application library for Cobra commands, with oh-my-posh prompts, and more. | 2026-01-15 | (Build Automation / Standard CLI)
- awesome-go - reeflective/console - loop application library for Cobra commands (powerful, ready-to-run and easy to use) ☆`100` (Command Line / Standard CLI)
- awesome-go-cn - console - loop application library for Cobra commands, with oh-my-posh prompts, and more. (命令行 / 标准CLI)
- fucking-awesome-go - console - loop application library for Cobra commands, with oh-my-posh prompts, and more. (Command Line / Standard CLI)
- awesome-go-plus - console - loop application library for Cobra commands, with oh-my-posh prompts, and more.  (Command Line / Standard CLI)
README
Console
Closed-loop application library for Cobra commands
(ready-to-use menus, prompts, completions, and more)
Console is an all-in-one console application library built on top of a [readline](https://github.com/reeflective/readline) shell and using [Cobra](https://github.com/spf13/cobra) commands.
It aims to provide users with a modern interface at at minimal cost while allowing them to focus on developing
their commands and application core: the console will then transparently interface with these commands, and provide
the various features below almost for free.
## Features
### Menus & Commands
- Bind cobra commands to provide the core functionality.
- Multiple menus with their own command tree, prompt engines and special handlers.
- All cobra settings can be modified, set and used freely, like in normal CLI workflows.
- Bind handlers to special interrupt errors (eg. `CtrlC`/`CtrlD`), per menu.
### Shell interface
- Shell is powered by a [readline](https://github.com/reeflective/readline) instance, with full `inputrc` support and extended functionality.
- All features of readline are supported in the console. It also allows the console to give:
- Configurable bind keymaps, commands and options, sane defaults, and per-application configuration.
- Out-of-the-box, advanced completions for commands, flags, positional and flag arguments.
- Provided by readline and [carapace](https://github.com/carapace-sh/carapace): automatic usage & validation command/flags/args hints.
- Syntax highlighting for commands (might be extended in the future).
### Others
- Support for an arbitrary number of history sources, per menu.
- Support for [oh-my-posh](https://github.com/JanDeDobbeleer/oh-my-posh) prompts, per menu and with custom configuration files for each.
- Also with oh-my-posh, write and bind application/menu-specific prompt segments.
- Set of ready-to-use commands (`commands/` directory) for readline binds/options manipulation.
## Documentation
You can install and use the [example application console](https://github.com/reeflective/console/tree/main/example). This example application
will give you a taste of the behavior and supported features. The following documentation
is also available in the [wiki](https://github.com/reeflective/console/wiki):
* [Getting started](https://github.com/reeflective/console/wiki/Getting-Started)
* [Menus](https://github.com/reeflective/console/wiki/Menus)
* [Prompts](https://github.com/reeflective/console/wiki/Prompts)
* [Binding commands](https://github.com/reeflective/console/wiki/Binding-Commands)
* [Interrupt handlers](https://github.com/reeflective/console/wiki/Interrupt-Handlers)
* [History Sources](https://github.com/reeflective/console/wiki/History-Sources)
* [Logging](https://github.com/reeflective/console/wiki/Logging)
* [Readline shell](https://github.com/reeflective/readline/wiki)
* [Other utilities](https://github.com/reeflective/console/wiki/Other-Utililites)
## Showcase

## Status
The library is in a pre-release candidate status:
- Although quite simple and small, it has not been tested heavily.
- There are probably some features/improvements to be made.
- The API is quite stable. It is unlikely to change much in future versions.
Please open a PR or an issue if you wish to bring enhancements to it.
Other contributions, as well as bug fixes and reviews are also welcome.