public void ShowOutputResult(InputInterpretationResult result, ConsoleUserInterfaceOptions options) { if (result.output != null) { ConsoleInteractor.WriteErrorMessage(result.output); } }
public void ShowOutputResult(InputInterpretationResult result, ConsoleUserInterfaceOptions options) { if (result.output != null) { var writer = new Runtime.SimpleJson.Writer(); writer.WriteObjectStart(); writer.WriteProperty("cmdOutput", result.output); writer.WriteObjectEnd(); ConsoleInteractor.WriteJsonError(writer.ToString()); } }
/// <summary>Processes the command line input result.</summary> /// <param name="uiResult">The UI result.</param> /// <param name="result">The result.</param> /// <param name="choiceCount">The choices counted.</param> public virtual void ProcessCommandLineInputResult(UserInteractionResult uiResult, InputInterpretationResult result, Runtime.IStory runtimeStory) { if (uiResult == null || result == null) { return; } uiResult.IsExitRequested = result.requestsExit; uiResult.ChosenIndex = result.choiceIdx; uiResult.DivertedPath = result.divertedPath; uiResult.Output = result.output; int choiceCount = 0; if (runtimeStory != null && runtimeStory.currentChoices != null) { choiceCount = runtimeStory.currentChoices.Count; } if (result.choiceIdx >= 0 && result.choiceIdx < choiceCount) { // The choice is only valid if it's a valid index. uiResult.IsValidChoice = true; } }