Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Powderhouse subsystems and directives #2351

Conversation

KathleenDollard
Copy link
Contributor

This addresses some of the issues raised in #2342 regarding directives (not response files environment variables(..

Remains in draft because:

  • There are more changes to the Tokenizer than I expected to evaluate directives separately - these changes extended to several files
  • I put some data onto the CLI Configuration, because I didn't know where to put it. When we determine how to carry information, we need to plan a way to tuck it away, probably similar to the SubSystem static class for subsystems.
  • A major piece of information is where the Tokenizer should begin. There are two reasons for this - the exe name may or may not be included in the args array and we need to deal with this, and Initialize methods for subsystems may have handled some of the args. We are limiting that handling to the start of the args array.
  • There are numerous naming and other issues to resolve, but I wanted to get the basics out for folks to look at before I am mostly busy next week.

@KathleenDollard
Copy link
Contributor Author

This issue has files changed that I did not expect. I need to review this with Jean or Mikayla, regardless of content, and I know it makes it hard to review. So, unless you are in a patient mood, you can wait for a cleaner PR.

I did not deliberately delete most of the code marked as deleted.

@KalleOlaviNiemitalo
Copy link

The changes might be easier to understand if you updated the API compatibility test files too.

@mhutch mhutch changed the base branch from main to main-powderhouse March 13, 2024 19:37
Copy link

@JeanJoeris JeanJoeris left a comment

Choose a reason for hiding this comment

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

Paired with @KathleenDollard reviewing this. Left comments from review. Overall looks good, big remaining questions this review does not address are largely around:

  • StringExtensions / Tokenizer
    • haven't reviewed as it is outdated / in flux
  • Handling of Directives as options
    • conversations around this are currently in flight

src/System.CommandLine.Subsystems.Tests/PipelineTests.cs Outdated Show resolved Hide resolved
src/System.CommandLine.Subsystems.Tests/PipelineTests.cs Outdated Show resolved Hide resolved
src/System.CommandLine.Subsystems/Pipeline.cs Outdated Show resolved Hide resolved
Comment on lines 63 to 66
public void MarkArgAsHandled(int argPos, string handledBy)
{

}

Choose a reason for hiding this comment

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

Do we want this empty, and is it related to the (possibly removed) HandledInfo?

src/System.CommandLine/CliConfiguration.cs Outdated Show resolved Hide resolved
@KathleenDollard
Copy link
Contributor Author

@KalleOlaviNiemitalo

The changes might be easier to understand if you updated the API compatibility test files too.

TBH, we are still getting everything to work with the split approach and have not given much thought to the API yet. We will do that a bit later.

I think the new subsystem approach will take some docs beyond API, and we're working on some design docs.

@@ -94,48 +103,48 @@ public void Long_form_options_can_be_specified_using_equals_delimiter()
result.GetResult(option).Tokens.Should().ContainSingle(a => a.Value == "there");
}

[Fact]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is not clear to me why whitespace is messed up here. Ideas? Maybe I found or created formatting nits and reformatted. Do we keep?

@@ -148,11 +149,11 @@ string CurrentToken()

configuration ??= new CliConfiguration(rootCommand);

CliTokenizer.Tokenize(
Tokenizer.Tokenize(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am open to the CliToken name, but thought we might avoid it internal members

@@ -27,10 +29,13 @@ internal static class StringExtensions
*/
}

internal static class CliTokenizer
internal static class Tokenizer
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can we skip CLI for internals, or does it add meaning?

@KathleenDollard KathleenDollard marked this pull request as ready for review March 30, 2024 11:02
@mhutch mhutch force-pushed the powderhouse-subsystem-fixes-and-directives branch from d4a316f to 9419c21 Compare April 4, 2024 04:37
* Preprocessed tokens can be skipped without messing up the
  location of subsequent tokens.
* Tokens from response files can have accurate location information.

This will enable better error handling and diagramming.
The configuration and args are now wrapped in an InitializationContext
The core parser no longer supports the special "directive" syntax,
but this abstract class provides a reusable implementation of
handling directive syntax in a subsystem using preprocessing.
@mhutch mhutch force-pushed the powderhouse-subsystem-fixes-and-directives branch from 9419c21 to 8cc20e9 Compare April 4, 2024 04:46
@mhutch mhutch force-pushed the powderhouse-subsystem-fixes-and-directives branch from 8cc20e9 to 06fa079 Compare April 4, 2024 05:39
@KathleenDollard KathleenDollard changed the title Powderhouse directives Powderhouse subsystems and directives Apr 4, 2024
@KathleenDollard KathleenDollard merged commit 84d40f3 into dotnet:main-powderhouse Apr 4, 2024
10 checks passed
@KathleenDollard KathleenDollard deleted the powderhouse-subsystem-fixes-and-directives branch April 4, 2024 20:13
@KathleenDollard KathleenDollard added the Powderhouse Work to isolate parser and features label Apr 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Powderhouse Work to isolate parser and features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants