Merge pull request #725 from piotrpMSFT/piotrpMSFT/issue724/CliUtilsPublic

Cli.Utils internal --> public
squashed
This commit is contained in:
Piotr Puszkiewicz 2016-01-06 00:57:19 -08:00
commit 4f18f938d4
35 changed files with 45 additions and 92 deletions

View file

@ -3,7 +3,7 @@
namespace Microsoft.DotNet.Cli.Utils namespace Microsoft.DotNet.Cli.Utils
{ {
internal static class AnsiColorExtensions public static class AnsiColorExtensions
{ {
public static string Black(this string text) public static string Black(this string text)
{ {

View file

@ -6,7 +6,7 @@ using System.IO;
namespace Microsoft.DotNet.Cli.Utils namespace Microsoft.DotNet.Cli.Utils
{ {
internal class AnsiConsole public class AnsiConsole
{ {
private AnsiConsole(TextWriter writer, bool useConsoleColor) private AnsiConsole(TextWriter writer, bool useConsoleColor)
{ {

View file

@ -15,7 +15,7 @@ using NuGet.Frameworks;
namespace Microsoft.DotNet.Cli.Utils namespace Microsoft.DotNet.Cli.Utils
{ {
internal class Command public class Command
{ {
private readonly Process _process; private readonly Process _process;
private readonly StreamForwarder _stdOut; private readonly StreamForwarder _stdOut;
@ -335,7 +335,7 @@ namespace Microsoft.DotNet.Cli.Utils
} }
} }
internal sealed class StreamForwarder public sealed class StreamForwarder
{ {
private const int DefaultBufferSize = 256; private const int DefaultBufferSize = 256;
@ -345,12 +345,12 @@ namespace Microsoft.DotNet.Cli.Utils
private Action<string> _write; private Action<string> _write;
private Action<string> _writeLine; private Action<string> _writeLine;
internal StreamForwarder(int bufferSize = DefaultBufferSize) public StreamForwarder(int bufferSize = DefaultBufferSize)
{ {
_bufferSize = bufferSize; _bufferSize = bufferSize;
} }
internal void Capture() public void Capture()
{ {
if (_capture != null) if (_capture != null)
{ {
@ -359,12 +359,12 @@ namespace Microsoft.DotNet.Cli.Utils
_capture = new StringWriter(); _capture = new StringWriter();
} }
internal string GetCapturedOutput() public string GetCapturedOutput()
{ {
return _capture?.GetStringBuilder()?.ToString(); return _capture?.GetStringBuilder()?.ToString();
} }
internal void ForwardTo(Action<string> write, Action<string> writeLine) public void ForwardTo(Action<string> write, Action<string> writeLine)
{ {
if (writeLine == null) if (writeLine == null)
{ {
@ -378,14 +378,14 @@ namespace Microsoft.DotNet.Cli.Utils
_writeLine = writeLine; _writeLine = writeLine;
} }
internal Thread BeginRead(TextReader reader) public Thread BeginRead(TextReader reader)
{ {
var thread = new Thread(() => Read(reader)) { IsBackground = true }; var thread = new Thread(() => Read(reader)) { IsBackground = true };
thread.Start(); thread.Start();
return thread; return thread;
} }
internal void Read(TextReader reader) public void Read(TextReader reader)
{ {
_builder = new StringBuilder(); _builder = new StringBuilder();
var buffer = new char[_bufferSize]; var buffer = new char[_bufferSize];

View file

@ -8,13 +8,13 @@ using System.Threading.Tasks;
namespace Microsoft.DotNet.Cli.Utils namespace Microsoft.DotNet.Cli.Utils
{ {
internal static class CommandContext public static class CommandContext
{ {
internal static class Variables public static class Variables
{ {
private static readonly string Prefix = "DOTNET_CLI_CONTEXT_"; private static readonly string Prefix = "DOTNET_CLI_CONTEXT_";
internal static readonly string Verbose = Prefix + "VERBOSE"; public static readonly string Verbose = Prefix + "VERBOSE";
internal static readonly string AnsiPassThru = Prefix + "ANSI_PASS_THRU"; public static readonly string AnsiPassThru = Prefix + "ANSI_PASS_THRU";
} }
private static Lazy<bool> _verbose = new Lazy<bool>(() => GetBool(Variables.Verbose)); private static Lazy<bool> _verbose = new Lazy<bool>(() => GetBool(Variables.Verbose));

View file

@ -3,7 +3,7 @@
namespace Microsoft.DotNet.Cli.Utils.CommandParsing namespace Microsoft.DotNet.Cli.Utils.CommandParsing
{ {
internal struct Chain<TLeft, TDown> public struct Chain<TLeft, TDown>
{ {
public Chain(TLeft left, TDown down) public Chain(TLeft left, TDown down)
: this() : this()

View file

@ -7,7 +7,7 @@ using System.Linq;
namespace Microsoft.DotNet.Cli.Utils.CommandParsing namespace Microsoft.DotNet.Cli.Utils.CommandParsing
{ {
internal class CommandGrammar : Grammar public class CommandGrammar : Grammar
{ {
private CommandGrammar(Func<string, string> variable, bool preserveSurroundingQuotes) private CommandGrammar(Func<string, string> variable, bool preserveSurroundingQuotes)
{ {

View file

@ -3,7 +3,7 @@
namespace Microsoft.DotNet.Cli.Utils.CommandParsing namespace Microsoft.DotNet.Cli.Utils.CommandParsing
{ {
internal struct Cursor public struct Cursor
{ {
private readonly string _text; private readonly string _text;
private readonly int _start; private readonly int _start;

View file

@ -6,7 +6,7 @@ using System.Linq;
namespace Microsoft.DotNet.Cli.Utils.CommandParsing namespace Microsoft.DotNet.Cli.Utils.CommandParsing
{ {
internal class Grammar public class Grammar
{ {
protected static Parser<IList<TValue>> Rep1<TValue>(Parser<TValue> parser) protected static Parser<IList<TValue>> Rep1<TValue>(Parser<TValue> parser)
{ {

View file

@ -3,5 +3,5 @@
namespace Microsoft.DotNet.Cli.Utils.CommandParsing namespace Microsoft.DotNet.Cli.Utils.CommandParsing
{ {
internal delegate Result<TValue> Parser<TValue>(Cursor cursor); public delegate Result<TValue> Parser<TValue>(Cursor cursor);
} }

View file

@ -7,7 +7,7 @@ using System.Linq;
namespace Microsoft.DotNet.Cli.Utils.CommandParsing namespace Microsoft.DotNet.Cli.Utils.CommandParsing
{ {
internal static class ParserExtensions public static class ParserExtensions
{ {
public static Parser<Chain<T1, T2>> And<T1, T2>(this Parser<T1> parser1, public static Parser<Chain<T1, T2>> And<T1, T2>(this Parser<T1> parser1,
Parser<T2> parser2) Parser<T2> parser2)

View file

@ -3,7 +3,7 @@
namespace Microsoft.DotNet.Cli.Utils.CommandParsing namespace Microsoft.DotNet.Cli.Utils.CommandParsing
{ {
internal struct Result<TValue> public struct Result<TValue>
{ {
public Result(TValue value, Cursor remainder) public Result(TValue value, Cursor remainder)
: this() : this()

View file

@ -9,7 +9,7 @@ using System.Runtime.InteropServices;
namespace Microsoft.DotNet.Cli.Utils namespace Microsoft.DotNet.Cli.Utils
{ {
internal static class Constants public static class Constants
{ {
public static readonly string ProjectFileName = "project.json"; public static readonly string ProjectFileName = "project.json";
public static readonly string ExeSuffix = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".exe" : string.Empty; public static readonly string ExeSuffix = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".exe" : string.Empty;

View file

@ -7,7 +7,7 @@ using System.Linq;
namespace Microsoft.DotNet.Cli.Utils namespace Microsoft.DotNet.Cli.Utils
{ {
internal static class DebugHelper public static class DebugHelper
{ {
[Conditional("DEBUG")] [Conditional("DEBUG")]
public static void HandleDebugSwitch(ref string[] args) public static void HandleDebugSwitch(ref string[] args)

View file

@ -6,7 +6,7 @@ using System.Runtime.InteropServices;
namespace Microsoft.DotNet.Cli.Utils namespace Microsoft.DotNet.Cli.Utils
{ {
internal static class Env public static class Env
{ {
private static IEnumerable<string> _searchPaths; private static IEnumerable<string> _searchPaths;
private static IEnumerable<string> _executableExtensions; private static IEnumerable<string> _executableExtensions;

View file

@ -7,7 +7,7 @@ using System.Runtime.InteropServices;
namespace Microsoft.DotNet.Tools.Common namespace Microsoft.DotNet.Tools.Common
{ {
internal static class PathUtility public static class PathUtility
{ {
public static bool IsPlaceholderFile(string path) public static bool IsPlaceholderFile(string path)
{ {

View file

@ -7,7 +7,7 @@ using System.Runtime.InteropServices;
namespace Microsoft.DotNet.Cli.Utils namespace Microsoft.DotNet.Cli.Utils
{ {
// Stupid-simple console manager // Stupid-simple console manager
internal class Reporter public class Reporter
{ {
private static readonly Reporter Null = new Reporter(console: null); private static readonly Reporter Null = new Reporter(console: null);
private static object _lock = new object(); private static object _lock = new object();

View file

@ -8,7 +8,7 @@ using Microsoft.DotNet.ProjectModel;
namespace Microsoft.DotNet.Cli.Utils namespace Microsoft.DotNet.Cli.Utils
{ {
internal static class ScriptExecutor public static class ScriptExecutor
{ {
public static Command CreateCommandForScript(Project project, string scriptCommandLine, IDictionary<string, string> variables) public static Command CreateCommandForScript(Project project, string scriptCommandLine, IDictionary<string, string> variables)
{ {

View file

@ -5,7 +5,7 @@ using System.Threading.Tasks;
namespace Microsoft.DotNet.Cli.Utils namespace Microsoft.DotNet.Cli.Utils
{ {
internal static class ScriptNames public static class ScriptNames
{ {
public const string PreCompile = "precompile"; public const string PreCompile = "precompile";
public const string PostCompile = "postcompile"; public const string PostCompile = "postcompile";

View file

@ -1,8 +1,6 @@
{ {
"version": "1.0.0-*", "version": "1.0.0-*",
"shared": "**/*.cs",
"dependencies": { "dependencies": {
"NETStandard.Library": "1.0.0-rc2-23616", "NETStandard.Library": "1.0.0-rc2-23616",
"Microsoft.DotNet.ProjectModel": "1.0.0", "Microsoft.DotNet.ProjectModel": "1.0.0",

View file

@ -7,10 +7,7 @@
"dependencies": { "dependencies": {
"NETStandard.Library": "1.0.0-rc2-23616", "NETStandard.Library": "1.0.0-rc2-23616",
"Microsoft.DotNet.Cli.Utils": { "Microsoft.DotNet.Cli.Utils": "1.0.0-*",
"type": "build",
"version": "1.0.0-*"
},
"Microsoft.Extensions.CommandLineUtils.Sources": { "Microsoft.Extensions.CommandLineUtils.Sources": {
"type": "build", "type": "build",
"version": "1.0.0-*" "version": "1.0.0-*"

View file

@ -11,10 +11,7 @@
"System.CommandLine": "0.1.0-*", "System.CommandLine": "0.1.0-*",
"Microsoft.CodeAnalysis.CSharp": "1.1.1", "Microsoft.CodeAnalysis.CSharp": "1.1.1",
"Microsoft.DotNet.ProjectModel": "1.0.0-*", "Microsoft.DotNet.ProjectModel": "1.0.0-*",
"Microsoft.DotNet.Cli.Utils": { "Microsoft.DotNet.Cli.Utils": "1.0.0-*"
"type": "build",
"version": "1.0.0-*"
}
}, },
"frameworks": { "frameworks": {
"dnxcore50": { } "dnxcore50": { }

View file

@ -12,10 +12,7 @@
"Microsoft.DotNet.ProjectModel": "1.0.0-*", "Microsoft.DotNet.ProjectModel": "1.0.0-*",
"Microsoft.DotNet.Compiler.Common": "1.0.0-*", "Microsoft.DotNet.Compiler.Common": "1.0.0-*",
"Microsoft.DotNet.Tools.Compiler": "1.0.0-*", "Microsoft.DotNet.Tools.Compiler": "1.0.0-*",
"Microsoft.DotNet.Cli.Utils": { "Microsoft.DotNet.Cli.Utils": "1.0.0-*",
"type": "build",
"version": "1.0.0-*"
},
"Microsoft.Extensions.CommandLineUtils.Sources": { "Microsoft.Extensions.CommandLineUtils.Sources": {
"type": "build", "type": "build",
"version": "1.0.0-*" "version": "1.0.0-*"

View file

@ -9,10 +9,7 @@
"Microsoft.Net.Compilers.netcore": "1.2.0-beta1-20151228-02", "Microsoft.Net.Compilers.netcore": "1.2.0-beta1-20151228-02",
"Microsoft.DotNet.Cli.Utils": { "Microsoft.DotNet.Cli.Utils": "1.0.0-*",
"type": "build",
"version": "1.0.0-*"
},
"Microsoft.Extensions.CommandLineUtils.Sources": { "Microsoft.Extensions.CommandLineUtils.Sources": {
"type": "build", "type": "build",
"version": "1.0.0-*" "version": "1.0.0-*"

View file

@ -9,10 +9,7 @@
"Microsoft.FSharp.Compiler.netcore": "1.0.0-alpha-151218", "Microsoft.FSharp.Compiler.netcore": "1.0.0-alpha-151218",
"Microsoft.DotNet.Cli.Utils": { "Microsoft.DotNet.Cli.Utils": "1.0.0-*",
"type": "build",
"version": "1.0.0-*"
},
"Microsoft.Extensions.CommandLineUtils.Sources": { "Microsoft.Extensions.CommandLineUtils.Sources": {
"type": "build", "type": "build",
"version": "1.0.0-*" "version": "1.0.0-*"

View file

@ -7,10 +7,7 @@
"dependencies": { "dependencies": {
"NETStandard.Library": "1.0.0-rc2-23616", "NETStandard.Library": "1.0.0-rc2-23616",
"Microsoft.DotNet.Cli.Utils": { "Microsoft.DotNet.Cli.Utils": "1.0.0-*",
"type": "build",
"version": "1.0.0-*"
},
"Microsoft.Extensions.CommandLineUtils.Sources": { "Microsoft.Extensions.CommandLineUtils.Sources": {
"type": "build", "type": "build",
"version": "1.0.0-*" "version": "1.0.0-*"

View file

@ -9,10 +9,7 @@
"System.Reflection.Metadata": "1.1.0", "System.Reflection.Metadata": "1.1.0",
"Microsoft.DotNet.ProjectModel": "1.0.0-*", "Microsoft.DotNet.ProjectModel": "1.0.0-*",
"Microsoft.DotNet.Compiler.Common": "1.0.0-*", "Microsoft.DotNet.Compiler.Common": "1.0.0-*",
"Microsoft.DotNet.Cli.Utils": { "Microsoft.DotNet.Cli.Utils": "1.0.0-*",
"type": "build",
"version": "1.0.0-*"
},
"Microsoft.Extensions.CommandLineUtils.Sources": { "Microsoft.Extensions.CommandLineUtils.Sources": {
"type": "build", "type": "build",
"version": "1.0.0-*" "version": "1.0.0-*"

View file

@ -8,10 +8,7 @@
"NETStandard.Library": "1.0.0-rc2-23616", "NETStandard.Library": "1.0.0-rc2-23616",
"Microsoft.DotNet.ProjectModel": "1.0.0-*", "Microsoft.DotNet.ProjectModel": "1.0.0-*",
"Microsoft.DotNet.Cli.Utils": { "Microsoft.DotNet.Cli.Utils": "1.0.0-*",
"type": "build",
"version": "1.0.0-*"
},
"Microsoft.Extensions.CommandLineUtils.Sources": { "Microsoft.Extensions.CommandLineUtils.Sources": {
"type": "build", "type": "build",
"version": "1.0.0-*" "version": "1.0.0-*"

View file

@ -10,10 +10,7 @@
"Microsoft.DotNet.Compiler.Common": "1.0.0-*", "Microsoft.DotNet.Compiler.Common": "1.0.0-*",
"Microsoft.DotNet.ProjectModel": "1.0.0-*", "Microsoft.DotNet.ProjectModel": "1.0.0-*",
"Microsoft.DotNet.Cli.Utils": { "Microsoft.DotNet.Cli.Utils": "1.0.0-*",
"type": "build",
"version": "1.0.0-*"
},
"Microsoft.Extensions.CommandLineUtils.Sources": { "Microsoft.Extensions.CommandLineUtils.Sources": {
"type": "build", "type": "build",
"version": "1.0.0-*" "version": "1.0.0-*"

View file

@ -8,10 +8,7 @@
"NETStandard.Library": "1.0.0-rc2-23616", "NETStandard.Library": "1.0.0-rc2-23616",
"Microsoft.DotNet.ProjectModel": "1.0.0-*", "Microsoft.DotNet.ProjectModel": "1.0.0-*",
"Microsoft.DotNet.Cli.Utils": { "Microsoft.DotNet.Cli.Utils": "1.0.0-*",
"type": "build",
"version": "1.0.0-*"
},
"Microsoft.Extensions.CommandLineUtils.Sources": { "Microsoft.Extensions.CommandLineUtils.Sources": {
"type": "build", "type": "build",
"version": "1.0.0-*" "version": "1.0.0-*"

View file

@ -9,10 +9,7 @@
"Microsoft.Net.CSharp.Interactive.netcore": "1.2.0-beta1-20151228-02", "Microsoft.Net.CSharp.Interactive.netcore": "1.2.0-beta1-20151228-02",
"Microsoft.DotNet.Cli.Utils": { "Microsoft.DotNet.Cli.Utils": "1.0.0-*",
"type": "build",
"version": "1.0.0-*"
},
"Microsoft.Extensions.CommandLineUtils.Sources": { "Microsoft.Extensions.CommandLineUtils.Sources": {
"type": "build", "type": "build",
"version": "1.0.0-*" "version": "1.0.0-*"

View file

@ -8,10 +8,7 @@
"NETStandard.Library": "1.0.0-rc2-23616", "NETStandard.Library": "1.0.0-rc2-23616",
"Microsoft.DotNet.ProjectModel": "1.0.0-*", "Microsoft.DotNet.ProjectModel": "1.0.0-*",
"Microsoft.DotNet.Cli.Utils": { "Microsoft.DotNet.Cli.Utils": "1.0.0-*",
"type": "build",
"version": "1.0.0-*"
},
"Microsoft.Extensions.CommandLineUtils.Sources": { "Microsoft.Extensions.CommandLineUtils.Sources": {
"type": "build", "type": "build",
"version": "1.0.0-*" "version": "1.0.0-*"

View file

@ -11,10 +11,7 @@
"Microsoft.CodeAnalysis.CSharp": "1.1.1", "Microsoft.CodeAnalysis.CSharp": "1.1.1",
"Microsoft.DotNet.Compiler.Common": "1.0.0-*", "Microsoft.DotNet.Compiler.Common": "1.0.0-*",
"Microsoft.DotNet.Cli.Utils": { "Microsoft.DotNet.Cli.Utils": "1.0.0-*",
"type": "build",
"version": "1.0.0-*"
},
"Microsoft.Extensions.CommandLineUtils.Sources": { "Microsoft.Extensions.CommandLineUtils.Sources": {
"type": "build", "type": "build",
"version": "1.0.0-*" "version": "1.0.0-*"

View file

@ -11,10 +11,7 @@
"System.CommandLine" : "0.1.0-d111815-3", "System.CommandLine" : "0.1.0-d111815-3",
"Microsoft.DotNet.ProjectModel": "1.0.0-*", "Microsoft.DotNet.ProjectModel": "1.0.0-*",
"Microsoft.DotNet.Cli.Utils": { "Microsoft.DotNet.Cli.Utils": "1.0.0-*"
"type": "build",
"version": "1.0.0-*"
}
}, },
"frameworks": { "frameworks": {
"dnxcore50": { } "dnxcore50": { }

View file

@ -14,10 +14,7 @@
"Microsoft.NETCore.ConsoleHost": "1.0.0-rc2-23616", "Microsoft.NETCore.ConsoleHost": "1.0.0-rc2-23616",
"Microsoft.NETCore.TestHost": "1.0.0-rc2-23616", "Microsoft.NETCore.TestHost": "1.0.0-rc2-23616",
"Microsoft.Extensions.Compilation.Abstractions": "1.0.0-*", "Microsoft.Extensions.Compilation.Abstractions": "1.0.0-*",
"Microsoft.DotNet.Cli.Utils": { "Microsoft.DotNet.Cli.Utils": "1.0.0-*",
"type": "build",
"version": "1.0.0-*"
},
"Microsoft.Dnx.Runtime.CommandParsing.Sources": { "Microsoft.Dnx.Runtime.CommandParsing.Sources": {
"version": "1.0.0-*", "version": "1.0.0-*",
"type": "build" "type": "build"

View file

@ -8,7 +8,7 @@
"dependencies": { "dependencies": {
"NETStandard.Library": "1.0.0-rc2-23614", "NETStandard.Library": "1.0.0-rc2-23614",
"Microsoft.DotNet.ProjectModel": "1.0.0-*", "Microsoft.DotNet.ProjectModel": "1.0.0-*",
"Microsoft.DotNet.Cli.Utils": "1.0.0-*", "Microsoft.DotNet.Cli.Utils": "1.0.0-*"
}, },
"frameworks": { "frameworks": {