In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces the relevant knowledge of "how to develop interactive command line application in C #". The editor shows you the operation process through an actual case. The operation method is simple, fast and practical. I hope this article "how to develop interactive command line applications in C #" can help you solve the problem.
Preface
If you have developed vue applications, you should be impressed by its interactive command line:
It allows you to create vue applications without any programming experience and just answer questions.
Although as .NET, we don't use the command line most of the time, we still want to be able to develop such interactive command-line applications, such as code generators, in C #.
Sharprompt introduction
Sharprompt is an interactive command line application framework based on C #, which has the following characteristics:
Multi-platform support
Support common prompts (normal input / password / options, etc.)
Model-based prompts are supported (in preview)
Verification of input valu
Automatically generate data sources using enumerated values
Customizable symbols and color modes
Unicode support
It provides the following common API:
Prompt.Input simple input prompt to return data of the specified type
Prompt.Password password prompt
Prompt.Confirm confirmation prompt, returns the value of Bool
Prompt.Select Radio Tip
Prompt.ColorSchema specifies the color scheme
Demo
Let's demonstrate how to use Sharprompt to generate an interactive command-line application.
The code is as follows:
Console.OutputEncoding = Encoding.UTF8;Prompt.ColorSchema.Select = ConsoleColor.DarkCyan;var type = Prompt.Select ("database type", new [] {"Oracle", "SQL Server", "MySQL", "PostgreSQL", "MariaDB"}, defaultValue: "MySQL", pageSize: 3); var server = Prompt.Input ("service address"); Prompt.ColorSchema.Answer = ConsoleColor.DarkRed;var name = Prompt.Input ("user name"); var password = Prompt.Password ("password") Console.WriteLine ($"you typed {type} {server} {name} {password}"); var confirm = Prompt.Confirm ("continue"); Console.WriteLine ($"your choice is {confirm}!"); this is the end of the introduction on "how to develop interactive command line applications in C#". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.