GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Write an error for powershell -version <any value> by iSazonov · Pull Request #4931 · PowerShell/PowerShell

Conversation

@iSazonov

@iSazonov Ilya (iSazonov) commented Sep 27, 2017

Copy link
Copy Markdown
Collaborator

Fix #4834

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@iSazonov
Write an error for powershell -version 2
993839d
@iSazonov Ilya (iSazonov) self-assigned this Sep 27, 2017
@iSazonov
Ilya (iSazonov) requested review from James Truher (JamesWTruher) and Steve Lee (SteveL-MSFT) September 27, 2017 13:19
@iSazonov
Ilya (iSazonov) requested review from Andrew (anmenaga), Dongbo Wang (daxian-dbw) and Jason Shirk (lzybkr) as code owners September 27, 2017 13:19
SteveL-MSFT
Steve Lee (SteveL-MSFT) requested changes Sep 27, 2017
View reviewed changes
Comment thread src/Microsoft.PowerShell.ConsoleHost/resources/CommandLineParameterParserStrings.resx Outdated
<value>Invalid argument '{0}', did you mean:</value>
</data>
<data name="DeprecatedVersionParameter" xml:space="preserve">
<value>Old functionality of '-version 2.0' is deprecated. Now '-version' parameter shows current PowerShell version. </value>

@SteveL-MSFT Steve Lee (SteveL-MSFT) Sep 27, 2017

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should change this error message to:

Previous usage of '-version {0}' is not supported.  '-version' currently only supports returning the current PowerShell version.

cc Joey Aiello (@joeyaiello)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@iSazonov Ilya (iSazonov) Sep 28, 2017

Copy link
Copy Markdown
Collaborator Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the error message - please review.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/Microsoft.PowerShell.ConsoleHost/host/msh/CommandLineParameterParser.cs Outdated
++i;
if (i < args.Length)
{
if (LanguagePrimitives.TryConvertTo<int>(args[i], out int verNumber) && verNumber == 2)

@SteveL-MSFT Steve Lee (SteveL-MSFT) Sep 27, 2017

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should currently error if any value is passed to -v

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@iSazonov Ilya (iSazonov) Sep 27, 2017

Copy link
Copy Markdown
Collaborator Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now we write the error and then show current version.
Please clarify your request.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@SteveL-MSFT Steve Lee (SteveL-MSFT) Sep 27, 2017

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't you only writing error if -v 2? Should also error if -v 3

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@iSazonov Ilya (iSazonov) Sep 27, 2017

Copy link
Copy Markdown
Collaborator Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. Will add the error for -v 3 too.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@SteveL-MSFT Steve Lee (SteveL-MSFT) Sep 27, 2017

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should error on any value passed to -v. In some future time if we decide to support launching different installed versions of PSCore6, we can decide if we want to overload -v or even introduce a new parameter.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@iSazonov Ilya (iSazonov) Sep 28, 2017

Copy link
Copy Markdown
Collaborator Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently we ignore all values after -v. The docs says the same: accept only 2.0 or 3.0. If anybody use the parameter the breaking change is related only to 2.0 or 3.0 values - we should write an error for the cases only.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@iSazonov Ilya (iSazonov) Sep 28, 2017

Copy link
Copy Markdown
Collaborator Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you comment #4836 - I am ready to implement enumeration of installed versioms.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@anmenaga Andrew (anmenaga) Sep 28, 2017

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we currently ignore all values after -v, then it seems logical to write error on any value passed to -v saying that parameter doesn't have any effect.
Having a parameter that quietly does nothing doesn't look good.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@iSazonov Ilya (iSazonov) Sep 29, 2017

Copy link
Copy Markdown
Collaborator Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is an enhancement. It make sense. Thanks!

Done.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@SteveL-MSFT
Steve Lee (SteveL-MSFT) requested a review from Joey Aiello (joeyaiello) September 27, 2017 16:38
Ilya (iSazonov) added 2 commits September 28, 2017 07:40
@iSazonov
Add error for -version 3.0
abfb77c
@iSazonov
Change error message
5a15659
@iSazonov
Ilya (iSazonov) force-pushed the version2error branch from 3d9f9b8 to 5a15659 Compare September 28, 2017 05:25
anmenaga
Andrew (anmenaga) suggested changes Sep 28, 2017
View reviewed changes

@anmenaga Andrew (anmenaga) left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add tests.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
SteveL-MSFT
Steve Lee (SteveL-MSFT) requested changes Sep 28, 2017
View reviewed changes
Comment thread src/Microsoft.PowerShell.ConsoleHost/host/msh/CommandLineParameterParser.cs Outdated
++i;
if (i < args.Length)
{
if (LanguagePrimitives.TryConvertTo<int>(args[i], out int verNumber) && (verNumber == 2 || verNumber == 3))

@SteveL-MSFT Steve Lee (SteveL-MSFT) Sep 28, 2017

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should error on any value passed to -v as part of this PR.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@iSazonov Ilya (iSazonov) Sep 29, 2017

Copy link
Copy Markdown
Collaborator Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@iSazonov
Write an error if we have any value after -Version parameter
e55b1b2
SteveL-MSFT
Steve Lee (SteveL-MSFT) approved these changes Sep 29, 2017
View reviewed changes
@iSazonov
Add test
e85edb6
anmenaga
Andrew (anmenaga) approved these changes Sep 29, 2017
View reviewed changes
@iSazonov Ilya (iSazonov) changed the title Write an error for powershell -version 2 Write an error for powershell -version <any value> Sep 29, 2017
@iSazonov
Ilya (iSazonov) merged commit 757c6b5 into PowerShell:master Sep 29, 2017
@iSazonov
Ilya (iSazonov) deleted the version2error branch September 29, 2017 19:20
@SteveL-MSFT Steve Lee (SteveL-MSFT) mentioned this pull request Sep 30, 2017
fix powershell -version and help #4958
Merged
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
@iSazonov
Write an error for powershell -version 2 (PowerShell#4931)
192a6c0
Write an error for powershell -version <any value>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@SteveL-MSFT Steve Lee (SteveL-MSFT) SteveL-MSFT approved these changes
@JamesWTruher James Truher (JamesWTruher) Awaiting requested review from JamesWTruher
@daxian-dbw Dongbo Wang (daxian-dbw) Awaiting requested review from daxian-dbw
@lzybkr Jason Shirk (lzybkr) Awaiting requested review from lzybkr
@joeyaiello Joey Aiello (joeyaiello) Awaiting requested review from joeyaiello
+1 more reviewer
@anmenaga Andrew (anmenaga) anmenaga approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@iSazonov Ilya (iSazonov)

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@iSazonov @SteveL-MSFT @anmenaga
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.