Skip to content

Commit

Permalink
Fix for #336 - Emit the helper doc link on connect (#337)
Browse files Browse the repository at this point in the history
  • Loading branch information
timheuer authored Jul 4, 2020
1 parent a4045fc commit 626a4f0
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Microsoft.HttpRepl/Commands/ConnectCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ private static void WriteStatus(IShellState shellState, HttpState programState)
{
shellState.ConsoleManager.WriteLine(string.Format(Resources.Strings.ConnectCommand_Status_Swagger, programState.SwaggerEndpoint));
}

// Always show help link after connecting
shellState.ConsoleManager.WriteLine(Resources.Strings.HelpCommand_Core_Details_Line2.Bold().Cyan());
}

private static ApiConnection GetConnectionInfo(IShellState shellState, HttpState programState, string rootAddress, string baseAddress, string swaggerAddress, IPreferences preferences)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ protected static string NormalizeOutput(string output, string baseUrl)
// next, normalize the date
result = _dateRegex.Replace(result, _dateReplacement);

// strip ansi begin/end formatting (bold, color)
result = Regex.Replace(result, @"\u001b\[[0-9]*m", string.Empty);

return result;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ cd api
string expected = NormalizeOutput(@"(Disconnected)> connect [BaseUrl]
Using a base address of [BaseUrl]/
Using OpenAPI description at [BaseUrl]/swagger/v1/swagger.json
For detailed tool info, see https://aka.ms/http-repl-doc
[BaseUrl]/> ls
. []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ cd api/values
string expected = NormalizeOutput(@"(Disconnected)> connect [BaseUrl]
Using a base address of [BaseUrl]/
Using OpenAPI description at [BaseUrl]/swagger/v1/swagger.json
For detailed tool info, see https://aka.ms/http-repl-doc
[BaseUrl]/> cd api/values
/api/values [GET|POST]
Expand Down Expand Up @@ -62,6 +63,7 @@ cd api/values
string expected = NormalizeOutput(@"(Disconnected)> connect [BaseUrl]
Using a base address of [BaseUrl]/
Using OpenAPI description at [BaseUrl]/swagger/v1/swagger.json
For detailed tool info, see https://aka.ms/http-repl-doc
[BaseUrl]/> cd api/values
/api/values [GET|POST]
Expand Down Expand Up @@ -93,6 +95,7 @@ cd api/invalidpath
string expected = NormalizeOutput(@"(Disconnected)> connect [BaseUrl]
Using a base address of [BaseUrl]/
Using OpenAPI description at [BaseUrl]/swagger/v1/swagger.json
For detailed tool info, see https://aka.ms/http-repl-doc
[BaseUrl]/> cd api/invalidpath
Warning: The '/api/invalidpath' endpoint is not present in the OpenAPI description
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ cd api
string expected = NormalizeOutput(@"(Disconnected)> connect [BaseUrl]
Using a base address of [BaseUrl]/
Using OpenAPI description at [BaseUrl]/swagger/v1/swagger.json
For detailed tool info, see https://aka.ms/http-repl-doc
[BaseUrl]/> ls
. []
Expand Down Expand Up @@ -60,6 +61,7 @@ cd api/Values
string expected = NormalizeOutput(@"(Disconnected)> connect [BaseUrl]
Using a base address of [BaseUrl]/
Using OpenAPI description at [BaseUrl]/swagger/v1/swagger.json
For detailed tool info, see https://aka.ms/http-repl-doc
[BaseUrl]/> cd api/Values
/api/Values [GET|POST]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ set header Accept application/json
string expected = NormalizeOutput(@"(Disconnected)> connect [BaseUrl]
Using a base address of [BaseUrl]/
Using OpenAPI description at [BaseUrl]/swagger/v1/swagger.json
For detailed tool info, see https://aka.ms/http-repl-doc
[BaseUrl]/> cd api/values
/api/values [GET|POST]
Expand Down Expand Up @@ -80,6 +81,7 @@ set header User-Agent
string expected = NormalizeOutput(@"(Disconnected)> connect [BaseUrl]
Using a base address of [BaseUrl]/
Using OpenAPI description at [BaseUrl]/swagger/v1/swagger.json
For detailed tool info, see https://aka.ms/http-repl-doc
[BaseUrl]/> cd api/values
/api/values [GET|POST]
Expand Down

0 comments on commit 626a4f0

Please sign in to comment.