Skip to content

System.CommandLine is split into too many namespaces  #1680

Closed

Description

@jkotas

I end up writing the following battery of namespaces into every project:

using System.CommandLine;
using System.CommandLine.Builder;
using System.CommandLine.Invocation;
using System.CommandLine.Parsing;

Should these namespaces be all folded into one?

This design is in conflict with .NET Framework design guidelines:

AVOID having too many namespaces.

Users of a framework should not have to import many namespaces in the most common scenarios.

Activity

  1. added
    bug
    on Mar 20, 2022
  2. added this to the 2.0 GA milestone on Mar 20, 2022
  3. Marusyk commented on Apr 16, 2022

    @Marusyk
    Member

    Can I take this one and remove System.CommandLine.Builder, CommandLine.Invocation, CommandLine.Parsing?
    what about backward compatibility?

  4. jonsequitur commented on Apr 16, 2022

    @jonsequitur
    Contributor

    I think some discussion is needed.

    There was concern in our previous API review that the root namespace would be too cluttered for people to immediately find the most important "entry point" types in the library, which is why more namespaces were created. It would be good to simplify, though, and now before we remove the preview tag is the time to make breaking changes.

  5. jonsequitur commented on Jun 30, 2022

    @jonsequitur
    Contributor

    Here's a list of proposed changes, intended to move some of the most common types into the root System.CommandLine namespace while leaving other less commonly-used types in their more specific namespaces so as not to introduce clutter.

    • Remove the System.CommandLine.Builder namespace and move its two types to System.CommandLine.
    • Move System.CommandLine.Parsing.ParseResult to System.CommandLine.
    • Move System.CommandLine.Invocation.ICommandHandler to System.CommandLine.
  6. glopesdev commented on Feb 3, 2025

    @glopesdev

    @jonsequitur Was this reopened by mistake? It seems like it had just been closed via a PR approved by you and it was reopened the same day without a comment, so just wondering.

  7. jonsequitur commented on Feb 4, 2025

    @jonsequitur
    Contributor

    I'm not sure. It's more likely it was closed by mistake because of the tag in the PR, but that there was more work to be done to declare the issue completed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-APIBreaking Changebug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions