Skip to content

Commit db292ec

Browse files
committed
Merge pull request #5 from travismc1/WarningForJobOutputType
Provide warning if specifying more than one job output type
2 parents ce00ba9 + 37c423f commit db292ec

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

src/ServiceManagement/HDInsight/Commands.HDInsight/Cmdlet/GetAzureHDInsightJobOutputCmdlet.cs

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,21 +136,39 @@ protected override void EndProcessing()
136136
this.command.CurrentSubscription = this.GetCurrentSubscription(this.Subscription, this.Certificate);
137137
this.AssertTaskLogsDirectorySpecified(this.TaskLogsDirectory);
138138

139-
if (this.StandardError.IsPresent)
139+
int numSpecifiedOutputTypes = 0;
140+
string selectedOutputType = "Standard Output";
141+
this.command.OutputType = JobOutputType.StandardOutput;
142+
143+
if (this.StandardOutput.IsPresent)
140144
{
141-
this.command.OutputType = JobOutputType.StandardError;
145+
numSpecifiedOutputTypes++;
142146
}
143-
else if (this.TaskSummary.IsPresent)
147+
148+
if (this.DownloadTaskLogs.IsPresent)
149+
{
150+
this.command.OutputType = JobOutputType.TaskLogs;
151+
selectedOutputType = "Task Logs";
152+
numSpecifiedOutputTypes++;
153+
}
154+
155+
if (this.TaskSummary.IsPresent)
144156
{
145157
this.command.OutputType = JobOutputType.TaskSummary;
158+
selectedOutputType = "Task Summary";
159+
numSpecifiedOutputTypes++;
146160
}
147-
else if (this.DownloadTaskLogs.IsPresent)
161+
162+
if (this.StandardError.IsPresent)
148163
{
149-
this.command.OutputType = JobOutputType.TaskLogs;
164+
this.command.OutputType = JobOutputType.StandardError;
165+
selectedOutputType = "Standard Error";
166+
numSpecifiedOutputTypes++;
150167
}
151-
else
168+
169+
if (numSpecifiedOutputTypes > 1)
152170
{
153-
this.command.OutputType = JobOutputType.StandardOutput;
171+
this.WriteWarning(String.Format("This cmdlet supports specifying only one job output type. Only {0} will be returned", selectedOutputType));
154172
}
155173

156174
try

0 commit comments

Comments
 (0)