Package: cli-utility
cli_utilityCli_utility is a python module whitch provide a high-level API to generate an appealing colorful single/multiple selection menu and informational logging output. Cli-utility brings a new life to boring command-line menus and log output programming.What can I do?Most things that you can do with cli_utility module! Here are a few examples to get you started:Generate a single/multiple selection menu and get the result easilyLogging messages with colorful[+][-][!][*]symbol by using built-in functionsFree logging output of custom foreground colors and meaningful symbolsUsing call chain to log messagesIssues or pull requests are welcome.Table of Contentscli_utilityTable of ContentsFeaturesGetting StartedInstallationUsageDependencesChange LogAlternativesFeaturesBeautiful single/multiple selection menu with default valueHighlight the selection lineStandardized color log toolsHighly customizable color log outputLog tools supports chain callSupport for all types of output supported by standard print functionsGetting StartedInstallationThis module can be easily installed withpip:pipinstallcli_utilityOr you can just usegit clone:gitcolnehttps://github.com/bluewingtan/cli_utility.gitUsageExample 1 - generate a single/multiple selection menu and get the resultUse direction keyup,downto move cursor. In single selection mode, use keyenterto select and confirm. Comparatively, in multiple selection mode, use keyspaceto select and keyenterto confirm.Here goes the single selection menu code:Code 1.1importcli_utilitymenu=cli_utility.cli_menu(False)logger=cli_utility.output_manager()choices=['Haruhi Suzumiya','Yuki Nagato','Mikuru Asahina']title='Who do you love?'selected=menu.show(title,choices)logger.print('Girls you selected:',fore_color=cli_utility.colorama.Fore.LIGHTCYAN_EX)logger.print_success(choices[selected])Result 1.1Here goes the multiple selection menu code:Code 1.2importcli_utilitymenu=cli_utility.cli_menu()logger=cli_utility.output_manager()choices=['Haruhi Suzumiya','Yuki Nagato','Mikuru Asahina']default_selection=[1]title='Who do you love?'selected=menu.show(title,choices,default_selection)logger.print('Girls you selected:',fore_color=cli_utility.colorama.Fore.LIGHTCYAN_EX)forindex,choiceinenumerate(choices):ifindexinselected:logger.print_success(choices[index])Result 1.2Example 2 - logging messages with colorful symbolHere goes the code:Code 2.1importcli_utilitylogger=cli_utility.output_manager()logger.print('What if you woke up one morning')logger.print('and everything changed?')logger.print_success('Yuki Nagato')logger.print_error('Haruhi Suzumiya')logger.print_info('Mikuru Asahina')logger.print_warn('Itsuki Koizumi')Result 2.1Example 3 - free logging output of custom foreground colors and meaningful symbolsHere goes the code:Code 3.1importcli_utilitylogger=cli_utility.output_manager()Kyon1=logger.print_string_constructor('What if you woke up one morning','[^] ',cli_utility.colorama.Fore.LIGHTGREEN_EX,cli_utility.colorama.Fore.LIGHTBLUE_EX)Kyon2=logger.print_string_constructor('and everything changed?','[%] ',cli_utility.colorama.Fore.LIGHTRED_EX,cli_utility.colorama.Fore.RED)logger.print(Kyon1)logger.print(Kyon2)logger.print_success('Yuki Nagato')logger.print_error('Haruhi Suzumiya')logger.print_info('Mikuru Asahina')logger.print_warn('Itsuki Koizumi')Result 3.1Example 4 - using call chain to log messagesHere goes the code:Code 4.1importcli_utilitylogger=cli_utility.output_manager()Kyon1=logger.print_string_constructor('What if you woke up one morning','[^] ',cli_utility.colorama.Fore.LIGHTGREEN_EX,cli_utility.colorama.Fore.LIGHTBLUE_EX)Kyon2=logger.print_string_constructor('and everything changed?','[%] ',cli_utility.colorama.Fore.LIGHTRED_EX,cli_utility.colorama.Fore.RED)logger.print(Kyon1)\.print(Kyon2)\.print_success('Yuki Nagato')\.print_error('Haruhi Suzumiya')\.print_info('Mikuru Asahina')\.print_warn('Itsuki Koizumi')Result 3.1DependencesCli_utility depend oncoloramaversion 0.4.1 and above version.Change Logversionsimple description1.0.0Initial repoAlternativestty_menu- python terminal memu (一个快速创建命令行菜单的工具)