Commit Graph
91 Commits
Author SHA1 Message Date
Jack CaseyandTravis Plunk 698742ea9f Test-Connection: Increase output detail when performing a tcp test (#11452)
* Added verbose TCP test logic

* Cleaned up output, removed source IP address

* Consolidated detailed output logic into ProcessConnectionByTCPPort()

* Updated existing tests with -Quiet switch

* Improved output formatting, changed logic to match

* Error handling and logic improvements

* Updated tests to match new output

* Updated logic, tcp tests now run once by default

* Moved TcpConnectionTestResult enum into TcpTestStatus class

* Removed unnecessary whitespace

* Wrapped TcpClient() in Using statement

* Appended missing period on comments

* Change TcpTestStatus to TcpPortStatus for better clarity

* Set default count back to 4

* Move stopwatch reset into finally block

* Change TcpConnectionTestResult.New to TcpConnectionTestResult.None

* Formatting fixes

* Increase column size for Result output

* Update logic for -quiet option

* Change "TestNum" property to "Id"

* Change Destination and DestinationAddress to Target and TargetAddress in TcpPortStatus

* Implement new form of using declaration

* Fix indentation

* Update output, improve logic and update tests

* Add CancellationToken to allow cancel before timeout

* Assign testResult.Connected to client.Connected

* Move TcpPortStatus object creation to after connection test

* Remove delay from final connection test in loop

* Move Count logic from ProcessConnectionByTCPPort into own function

* Fix small formatting error

* Add handling for TaskCanceledException

* Remove redundant CancellationToken getter

* Clean up handling of SocketException

* Increase readability of final loop check

* Remove unnecessary TimeSpan invocation

* Rename cancellationTokenSource to match convention

* Move SetCountForTcpTest() into BeginProcessing()

* Added nameof to Count check

* Removed explicit type declaration for TcpClient

* Move delay and timeout evaluation out of the cycle

* Remove redundant CancellationTokenSource

* Initialize detailed SwitchParameter

* Add check for Detailed parameter

* Remove redundant tests for non-detailed output

* Add return after first boolean output

* Update tests with new detailed parameter set

---------

Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
2023-05-01 14:16:11 -07:00
Steve Lee ec258e210f Fix ConciseView to handle custom ParserError error records (#19239) 2023-03-01 11:18:11 -08:00
Dongbo Wang 79b4b5c33f Update the FeedbackProvider interface to return structured data (#19133) 2023-02-22 16:01:18 -08:00
Dongbo Wang 4756506d22 Fix error formatting to remove the unneeded leading newline for concise view (#19080) 2023-02-08 09:54:08 -08:00
Steve Lee 2baeb1a7f0 Fix Get-Error to work with strict mode (#18895) 2023-01-13 18:00:20 +05:00
Dongbo Wang eb31d32724 Enable creating composite subsystem implementation in modules (#18888) 2023-01-05 09:51:45 -08:00
Steve Lee 52ea419662 Add Dim and DimOff to $PSStyle (#18653) 2022-11-29 16:13:59 -08:00
Steve Lee 65b353d9cf The command prefix should also be in the error color for NormalView (#18555) 2022-11-15 17:54:23 -08:00
Dongbo Wang 53c3690c2a Replace command-error suggestion with new implementation based on subsystem plugin (#18252) 2022-10-24 11:59:32 -07:00
Dongbo Wang 618d1a7c78 Minor update to the FileInfo table formatting on Unix to make it more concise (#18183) 2022-09-29 16:22:53 -07:00
Dongbo Wang 647f40bb4a Fix error formatting to use color defined in $PSStyle.Formatting (#17987) 2022-08-31 09:36:14 -07:00
Dongbo Wang 543f5209c0 Support mapping foreground/background ConsoleColor values to VT escape sequences (#17938) 2022-08-24 23:11:18 +05:00
Steve Lee 1437d85a44 Fix legacy ErrorView types to use $host.PrivateData colors (#17705) 2022-07-18 17:07:47 -07:00
Dongbo Wang c8984c0517 Make property names for the color VT sequences consistent with documentations (#16212) 2021-10-11 14:58:51 -07:00
Steve Lee dda6c156d2 Fix $PSStyle list output to correctly show TableHeader (#15928) 2021-08-13 15:40:07 -07:00
Steve Lee cced56d75a Make PS-Committee reviewed experimental features stable (#15864) 2021-08-09 14:01:57 -07:00
Steve Lee 5e15f66f97 Add validation to $PSStyle to reject printable text as ANSI escape sequence (#15825) 2021-07-27 17:14:20 +00:00
Steve Lee b5efe7bc39 Use $PSStyle.Formatting.FormatAccent for Format-List and $PSStyle.Formatting.TableHeader for Format-Table output (#14406) 2021-07-20 09:02:52 +05:00
Steve Lee 9fb3c2e97c Highlight using error color the exception Message and underline in PositionMessage for Get-Error (#15786) 2021-07-16 15:15:16 +05:00
Steve Lee bfb4a818bf Add support to colorize FileInfo file names (#14403) 2021-07-12 11:07:29 -07:00
Steve Lee 375be2e705 Add DetailedView to $ErrorView (#15609) 2021-06-22 13:35:38 -07:00
xtqqczze e92201779d Enable SA1001: Commas should be spaced correctly (#14171) 2021-03-30 15:17:17 -07:00
Steve Lee c9d65061af Add UseOSCIndicator setting to enable progress indicator in terminal (#14927) 2021-03-11 17:29:17 -08:00
Steve Lee 597bfc9696 Update Concise ErrorView to not show line information for errors from script module functions (#14912) 2021-03-08 23:37:11 +05:00
Steve Lee 887467eb32 Add minimal progress bar using ANSI rendering (#14414) 2021-02-05 10:50:20 -08:00
Steve Lee bc080921bf Add support to $PSStyle for strikethrough and hyperlinks (#14461) 2020-12-19 11:54:51 +05:00
Steve Lee a99ea2acd2 Enable ANSI formatting via $PSStyle and support suppressing ANSI output (#13758) 2020-12-11 10:33:57 -08:00
Dongbo Wang 2728574df7 Rename 'Get-Subsystem' to 'Get-PSSubsystem' and fix two minor issues (#13765) 2020-10-14 09:42:37 -07:00
Steve Lee 36ba1092a8 Fix case where exception message contains "`n" on Windows (#13684) 2020-09-24 23:43:33 +05:00
Steve Lee d25d964d57 Fix ConciseView for interactive advanced function writing error (#13623) 2020-09-14 11:07:37 -07:00
Dongbo Wang fc4c9cbfd7 Initial work of the subsystem plugin model (for minimal powershell) (#13186) 2020-08-20 17:41:44 -07:00
Thomas Nieto 46efd38ef5 Fix Get-Help not properly displaying if parameter supports wildcards (#13353) 2020-08-11 10:20:45 -07:00
Thomas Nieto bedd3bc287 Remove AssemblyInfo property from list views (#13331) 2020-08-05 12:17:09 -07:00
Steve Lee ec20043a91 Remove use of Test-Path in ConciseView (#12778) 2020-06-11 16:07:18 +05:00
Dan Thompson 0137920d89 Make module formatting not generate error with strict mode (#11943) 2020-05-27 15:43:01 -07:00
Steve Lee b7cb335f03 Update copyright notice to latest guidance (#12190) 2020-03-24 11:08:37 -07:00
Ilya 43e0e1a1c5 Fix default formatting for deserialized MatchInfo (#11728)
MatchInfo class has ToEmphasizedString() member method to color output line.
In remote scenario MatchInfo class is deserialized as Deserialized.Microsoft.PowerShell.Commands.MatchInfo without the method. As result default formating in remote scenario show nothing.

The fix is to directly output Line property.
2020-03-18 18:43:01 +05:00
Dongbo Wang 348ca85947 Fix ConciseView to split PositionMessage using [Environment]::NewLine (#12010) 2020-03-04 13:03:08 -08:00
Steve Lee 2db8516a8c Fix ConciseView to not show the line information within the error messages (#11952) 2020-02-26 21:07:57 +05:00
Steve Lee 34f9b43514 Fix ConciseView where error message is wider than window width and doesn't have whitespace (#11880) 2020-02-20 08:38:28 +05:00
Steve Lee 5edafb6afd Fix ConciseView to handle case where there isn't a console to obtain the width (#11784) 2020-02-12 11:48:58 +05:00
xtqqczze c73a599469 Update PSPath in certificate_format_ps1.xml (#11603)
`PSPathPath` is an invalid item property name
2020-02-03 13:03:44 -08:00
Steve Lee 66912b7428 Fix unnecessary trimming of line resulting in incorrect indexi… (#11670) 2020-01-30 11:03:39 -08:00
Ilya ac069185d6 Fix NRE in ConsiceView (#11435)
Use LanguagePrimitives.TryConvertTo() as last resort to string conversion.
2020-01-14 08:33:16 +05:00
Steve Lee 5b42126f7c Don't format exceptions that aren't ErrorRecords (#11415)
* In one of the previous PRs for ConciseView, System.Exception was incorrectly added to the typenames handled by the ErrorRecord formatting. This results in just Exception objects written to the console to not be rendered since the ErrorRecord formatting didn't handle this situation. Fix is to remove the line to add that type putting it back to how it was previously. 

* Also made the handling of ErrorRecord a bit more robust just in case Exception.Message doesn't exist nor a Message property.
2019-12-21 09:45:44 +05:00
Steve Lee a1066ac0ac Use PositionMessage for the line context information for ConciseView (#11398) 2019-12-19 09:42:37 -08:00
Steve Lee 563b1cba83 Add trailing line number to filename for ConciseView (#11391) 2019-12-18 14:05:56 -08:00
Steve Lee ab6b41dce3 Remove unnecessary newline in ConciseView (#11383)
* Add newline only if it's missing
2019-12-18 10:22:01 +05:00
Steve Lee edd3e7680c Move Set-StrictMode to outer scriptblock for ErrorView (#11381) 2019-12-17 23:43:47 +05:00
Steve Lee 6e4da244c5 Update ConciseView to use TargetObject if applicable (#11075) 2019-12-10 09:50:51 -08:00