Skip to content

Commit

Permalink
Display host help even if not in a function app directory.
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmelsayed committed Jun 30, 2017
1 parent 9fb7181 commit 9cce2fd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Azure.Functions.Cli/Actions/HelpAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using System.Text;
using Fclp.Internals;
using Colors.Net.StringColorExtensions;
using Azure.Functions.Cli.Helpers;

namespace Azure.Functions.Cli.Actions
{
Expand Down Expand Up @@ -56,6 +57,8 @@ public HelpAction(IEnumerable<TypeAttributePair> actions, Func<Type, IAction> cr

public override Task RunAsync()
{
ScriptHostHelpers.SetIsHelpRunning();

Utilities.PrintLogo();
if (!string.IsNullOrEmpty(_context) || !string.IsNullOrEmpty(_subContext))
{
Expand Down
11 changes: 11 additions & 0 deletions src/Azure.Functions.Cli/Helpers/ScriptHostHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ namespace Azure.Functions.Cli.Helpers
public static class ScriptHostHelpers
{
private const TraceLevel DefaultTraceLevel = TraceLevel.Info;
private static bool _isHelpRunning = false;

public static void SetIsHelpRunning()
{
_isHelpRunning = true;
}

public static FunctionMetadata GetFunctionMetadata(string functionName)
{
Expand All @@ -39,6 +45,11 @@ public static FunctionMetadata GetFunctionMetadata(string functionName)

public static string GetFunctionAppRootDirectory(string startingDirectory)
{
if (_isHelpRunning)
{
return startingDirectory;
}

var hostJson = Path.Combine(startingDirectory, ScriptConstants.HostMetadataFileName);
if (FileSystemHelpers.FileExists(hostJson))
{
Expand Down

0 comments on commit 9cce2fd

Please sign in to comment.