Skip to content

Exit after printing out version information#743

Merged
xperiandri merged 4 commits into
fsprojects:masterfrom
Numpsy:version_exit
Jul 16, 2025
Merged

Exit after printing out version information#743
xperiandri merged 4 commits into
fsprojects:masterfrom
Numpsy:version_exit

Conversation

@Numpsy
Copy link
Copy Markdown
Contributor

@Numpsy Numpsy commented Jul 10, 2025

Rather than then trying to call GetSubCommand() and breaking when there isn't one.

refs #741

Just a thought at a simple change to exit after printing the version information, rather than making a call to GetSubCommand() that can fail if there no other commands specified.

If it needs to support printing the version and then doing a lint, maybe it needs to use TryGetSubCommand() instead.

@xperiandri
Copy link
Copy Markdown
Collaborator

I agree

@xperiandri xperiandri requested a review from Copilot July 11, 2025 13:45
@xperiandri
Copy link
Copy Markdown
Collaborator

@webwarrior-ws @Numpsy do you have any remarks?

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Ensures that when the --version flag is used, the program prints version info and takes a dedicated code path rather than immediately invoking the subcommand logic.

  • Added an else branch so that handleError is only defined when not printing version
  • Cleaned up a stray whitespace line after version printing

Comment thread src/FSharpLint.Console/Program.fs Outdated
@knocte
Copy link
Copy Markdown
Collaborator

knocte commented Jul 11, 2025

Why not do what Copilot proposes instead of doing a huge diff that just shifts code to the right?

@xperiandri
Copy link
Copy Markdown
Collaborator

@Numpsy, what do you think about the suggestion?

Rather than then trying to call GetSubCommand() and breaking when there isn't one.
@Numpsy
Copy link
Copy Markdown
Contributor Author

Numpsy commented Jul 16, 2025

@Numpsy, what do you think about the suggestion?

I'm not personally partucularly fond of early process exit, but have changed it to that if that's what is preferred

@knocte
Copy link
Copy Markdown
Collaborator

knocte commented Jul 16, 2025

refs #741

Not sure the text "refs #123" makes the closing of #123 be automatic, maybe it needs to be "Fixes", not "refs"?
BTW, please also use this in commit msg, not just in PR description.

Comment thread src/FSharpLint.Console/Program.fs Outdated
Comment thread src/FSharpLint.Console/Program.fs Outdated
Comment thread src/FSharpLint.Console/Program.fs
@xperiandri xperiandri merged commit 1447adf into fsprojects:master Jul 16, 2025
5 checks passed
xperiandri added a commit that referenced this pull request Jul 18, 2025
## [0.26.0] - 2025-07-18

- Fix MSBuild integration sample in docs #750 [@xperiandri]
- Exit after printing out version information #743 [@Numpsy]
- Fix .NET 8 support #748 [@xperiandri]
- Update docs to note that linting supports `slnx` and `slnf` files #744 [@Numpsy]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants