Example:
PromptOptions popts;
popts.setOptions(_("y/n/p"), 0 / * default reply * /);
popts.setOptionHelp(0, _("Help for option 'y'"));
popts.setOptionHelp(1, _("Help for option 'n'"));
...
zypper.out().prompt(PROMPT_YN_INST_REMOVE_CONTINUE, prompt_text, popts);
unsigned reply =
get_prompt_reply(zypper, PROMPT_YN_INST_REMOVE_CONTINUE, popts);
More...
#include <zypp-tui/output/promptoptions.h>
Example:
PromptOptions popts;
popts.setOptions(_("y/n/p"), 0 / * default reply * /);
popts.setOptionHelp(0, _("Help for option 'y'"));
popts.setOptionHelp(1, _("Help for option 'n'"));
...
zypper.out().prompt(PROMPT_YN_INST_REMOVE_CONTINUE, prompt_text, popts);
unsigned reply =
get_prompt_reply(zypper, PROMPT_YN_INST_REMOVE_CONTINUE, popts);
Definition at line 38 of file promptoptions.h.
◆ StrVector
◆ PromptOptions() [1/3]
ztui::PromptOptions::PromptOptions |
( |
| ) |
|
|
inline |
◆ PromptOptions() [2/3]
ztui::PromptOptions::PromptOptions |
( |
StrVector | options_r, |
|
|
unsigned | defaultOpt_r ) |
◆ PromptOptions() [3/3]
ztui::PromptOptions::PromptOptions |
( |
const std::string & | optionstr_r, |
|
|
unsigned | defaultOpt_r ) |
Constructor.
- Parameters
-
optionstr_r | translated option string containing one or more options separated by slash '/' character e.g. "yes/no/?" or "1/s/r/c" |
defaultOpt_r | index of the default answer within the option_str |
Definition at line 23 of file promptoptions.cc.
◆ ~PromptOptions()
ztui::PromptOptions::~PromptOptions |
( |
| ) |
|
◆ options()
const StrVector & ztui::PromptOptions::options |
( |
| ) |
const |
|
inline |
◆ setOptions() [1/2]
void ztui::PromptOptions::setOptions |
( |
StrVector | options_r, |
|
|
unsigned | defaultOpt_r ) |
◆ setOptions() [2/2]
void ztui::PromptOptions::setOptions |
( |
const std::string & | optionstr_r, |
|
|
unsigned | defaultOpt_r ) |
◆ defaultOpt()
unsigned ztui::PromptOptions::defaultOpt |
( |
| ) |
const |
|
inline |
◆ optionString()
ColorString ztui::PromptOptions::optionString |
( |
| ) |
const |
◆ empty()
bool ztui::PromptOptions::empty |
( |
| ) |
const |
|
inline |
◆ isYesNoPrompt()
bool ztui::PromptOptions::isYesNoPrompt |
( |
| ) |
const |
◆ optionHelp()
const std::string & ztui::PromptOptions::optionHelp |
( |
unsigned | opt | ) |
const |
|
inline |
◆ setOptionHelp()
void ztui::PromptOptions::setOptionHelp |
( |
unsigned | opt, |
|
|
const std::string & | help_str ) |
◆ helpEmpty()
bool ztui::PromptOptions::helpEmpty |
( |
| ) |
const |
|
inline |
◆ isEnabled()
bool ztui::PromptOptions::isEnabled |
( |
unsigned | opt | ) |
const |
|
inline |
◆ isDisabled()
bool ztui::PromptOptions::isDisabled |
( |
unsigned | opt | ) |
const |
|
inline |
◆ disable()
void ztui::PromptOptions::disable |
( |
unsigned | opt | ) |
|
|
inline |
◆ enable()
void ztui::PromptOptions::enable |
( |
unsigned | opt | ) |
|
|
inline |
◆ enableAll()
void ztui::PromptOptions::enableAll |
( |
| ) |
|
|
inline |
◆ shownCount()
unsigned ztui::PromptOptions::shownCount |
( |
| ) |
const |
|
inline |
◆ setShownCount()
void ztui::PromptOptions::setShownCount |
( |
unsigned | count | ) |
|
|
inline |
◆ getReplyMatches()
std::vector< int > ztui::PromptOptions::getReplyMatches |
( |
const std::string & | reply_r | ) |
const |
Return the indices of option string matches (lowercase/prefix or #NUM).
Definition at line 117 of file promptoptions.cc.
◆ replyMatchesStr()
std::string ztui::PromptOptions::replyMatchesStr |
( |
const std::vector< int > & | matches_r | ) |
const |
◆ _options
◆ _default
unsigned ztui::PromptOptions::_default = 0 |
|
private |
◆ _opt_help
◆ _disabled
std::set<unsigned> ztui::PromptOptions::_disabled |
|
private |
◆ _shown_count
int ztui::PromptOptions::_shown_count = -1 |
|
private |
Number of options to show (the rest will still be available and visible through '?
' help). If negative, all options will be shown. Zero is allowed.
Definition at line 114 of file promptoptions.h.
The documentation for this class was generated from the following files: