@@ -49,12 +49,14 @@ namespace AppInstaller::CLI::Execution
49
49
};
50
50
51
51
// The level for the Output channel.
52
- enum class Level
52
+ enum class Level : uint32_t
53
53
{
54
- Verbose,
55
- Info,
56
- Warning,
57
- Error,
54
+ None = 0x0 ,
55
+ Verbose = 0x1 ,
56
+ Info = 0x2 ,
57
+ Warning = 0x4 ,
58
+ Error = 0x8 ,
59
+ All = Verbose | Info | Warning | Error,
58
60
};
59
61
60
62
Reporter (std::ostream& outStream, std::istream& inStream);
@@ -98,13 +100,13 @@ namespace AppInstaller::CLI::Execution
98
100
void SetStyle (AppInstaller::Settings::VisualStyle style);
99
101
100
102
// Prompts the user, return true if they consented.
101
- bool PromptForBoolResponse (Resource::LocString message, Level level = Level::Info);
103
+ bool PromptForBoolResponse (Resource::LocString message, Level level = Level::Info, bool resultIfDisabled = false );
102
104
103
105
// Prompts the user, continues when Enter is pressed
104
106
void PromptForEnter (Level level = Level::Info);
105
107
106
108
// Prompts the user for a path.
107
- std::filesystem::path PromptForPath (Resource::LocString message, Level level = Level::Info);
109
+ std::filesystem::path PromptForPath (Resource::LocString message, Level level = Level::Info, std::filesystem::path resultIfDisabled = std::filesystem::path::path() );
108
110
109
111
// Used to show indefinite progress. Currently an indefinite spinner is the form of
110
112
// showing indefinite progress.
@@ -165,9 +167,15 @@ namespace AppInstaller::CLI::Execution
165
167
m_progressSink = sink;
166
168
}
167
169
170
+ bool IsLevelEnabled (Level reporterLevel)
171
+ {
172
+ return WI_AreAllFlagsSet (m_enabledLevels, reporterLevel);
173
+ }
174
+
175
+ void SetLevelMask (Level reporterLevel, bool setEnabled = true );
176
+
168
177
private:
169
178
Reporter (std::shared_ptr<BaseStream> outStream, std::istream& inStream);
170
-
171
179
// Gets a stream for output for internal use.
172
180
OutputStream GetBasicOutputStream ();
173
181
@@ -180,8 +188,13 @@ namespace AppInstaller::CLI::Execution
180
188
wil::srwlock m_progressCallbackLock;
181
189
std::atomic<ProgressCallback*> m_progressCallback;
182
190
std::atomic<IProgressSink*> m_progressSink;
191
+
192
+ // Enable all levels by default
193
+ Level m_enabledLevels = Level::All;
183
194
};
184
195
196
+ DEFINE_ENUM_FLAG_OPERATORS (Reporter::Level);
197
+
185
198
// Indirection to enable change without tracking down every place
186
199
extern const VirtualTerminal::Sequence& HelpCommandEmphasis;
187
200
extern const VirtualTerminal::Sequence& HelpArgumentEmphasis;
0 commit comments