Merge pull request 230 from dev/console-prompt into develop

Merge dev/console-prompt to develop
This commit is contained in:
Zach Folwick
2015-10-30 17:58:56 +00:00
3 changed files with 13 additions and 11 deletions
+12 -9
View File
@@ -164,7 +164,15 @@ namespace Microsoft.Samples.PowerShell.Host
/// Sets the prompt equal to the output of the prompt function
public string Prompt(Runspace rs)
{
string returnVal = string.Empty;
string returnVal = string.Empty;
if (this.myHost.IsRunspacePushed)
{
returnVal = string.Format("\n[{0}] PSL> ", this.myRunSpace.ConnectionInfo.ComputerName);
return returnVal;
}
// TODO: if we are in block mode, sep the prome to ">> "
Pipeline pipeline = rs.CreatePipeline();
Command promptCommand = new Command("prompt");
@@ -210,6 +218,8 @@ namespace Microsoft.Samples.PowerShell.Host
{
this.currentPowerShell.Runspace = this.myRunSpace;
// TODO: Find out where this is set in the Monad host code and set all defaults that way
this.currentPowerShell.AddScript(string.Format("(Get-PSProvider 'FileSystem').Home = '{0}'",Environment.GetEnvironmentVariable("HOME")));
this.currentPowerShell.AddScript(cmd);
// Add the default outputter to the end of the pipe and then call the
@@ -373,14 +383,7 @@ namespace Microsoft.Samples.PowerShell.Host
while (!this.ShouldExit)
{
string prompt;
if (this.myHost.IsRunspacePushed)
{
prompt = string.Format("\n[{0}] PSL> ", this.myRunSpace.ConnectionInfo.ComputerName);
}
else
{
prompt = Prompt(this.myHost.Runspace);
}
prompt = Prompt(this.myHost.Runspace);
this.myHost.UI.Write(ConsoleColor.White, ConsoleColor.Black, prompt);
// string cmd = this.consoleReadLine.Read();
-1
View File
@@ -304,7 +304,6 @@ namespace ps_hello_world
public override void WriteDebugLine(string message)
{
Console.BackgroundColor = ConsoleColor.Black;
Console.ForegroundColor = ConsoleColor.Yellow;
Console.Write(String.Format(
CultureInfo.CurrentCulture,
+1 -1
View File
@@ -374,7 +374,7 @@ ReadNext:
public override void WriteDebugLine(string message)
{
this.WriteLine(
ConsoleColor.DarkYellow,
ConsoleColor.Yellow,
ConsoleColor.Black,
String.Format(CultureInfo.CurrentCulture, "DEBUG: {0}", message));
}