extract IsInteractive to separate method
This commit is contained in:
parent
e8b9a44489
commit
db9f9dfa6e
1 changed files with 12 additions and 12 deletions
|
@ -20,38 +20,38 @@ namespace Microsoft.DotNet.Tools.Run
|
||||||
public string Project = null;
|
public string Project = null;
|
||||||
public IReadOnlyList<string> Args = null;
|
public IReadOnlyList<string> Args = null;
|
||||||
|
|
||||||
bool _isInteractive = false;
|
|
||||||
ProjectContext _context;
|
ProjectContext _context;
|
||||||
List<string> _args;
|
List<string> _args;
|
||||||
|
|
||||||
public int Start()
|
public int Start()
|
||||||
{
|
{
|
||||||
CalculateDefaultsForNonAssigned();
|
if (IsInteractive())
|
||||||
|
|
||||||
if (_isInteractive)
|
|
||||||
{
|
{
|
||||||
return RunInteractive(Project);
|
return RunInteractive(Project);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
CalculateDefaultsForNonAssigned();
|
||||||
return RunExecutable();
|
return RunExecutable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CalculateDefaultsForNonAssigned()
|
private bool IsInteractive()
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(Project))
|
if (!string.IsNullOrEmpty(Project))
|
||||||
{
|
{
|
||||||
if (File.Exists(Project) && (Path.GetExtension(Project) == ".csx"))
|
if (File.Exists(Project) && (Path.GetExtension(Project).ToLowerInvariant() == ".csx"))
|
||||||
{
|
{
|
||||||
_isInteractive = true;
|
return true;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CalculateDefaultsForNonAssigned()
|
||||||
{
|
{
|
||||||
Project = Directory.GetCurrentDirectory();
|
Project = Directory.GetCurrentDirectory();
|
||||||
}
|
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(Configuration))
|
if (string.IsNullOrWhiteSpace(Configuration))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue