Skip to content

Move Parse extension methods to the appropriate Symbol types #1901

Closed

Description

@jonsequitur
        // This method group looks fine, but should be an instance method on Argument, or a non-extension method somewhere else.
        // I recommend using different names for the two overloads.  That would allow you to use `params string[] args` for the latter.
        // Argument::Parse(string) and Argument::ParseArguments(params string[] args), maybe?
        public static ParseResult Parse(this Argument argument, string commandLine);
        public static ParseResult Parse(this Argument argument, string[] args);
    }

Activity

  1. KalleOlaviNiemitalo commented on Nov 5, 2022

    @KalleOlaviNiemitalo

    Call it ParseArgumentList so it is similar to ProcessStartInfo.ArgumentList.

  2. jonsequitur commented on Nov 6, 2022

    @jonsequitur
    ContributorAuthor

    One possible concern there is that "argument" means something more specific in the context of the parser.

  3. KalleOlaviNiemitalo commented on Nov 8, 2022

    @KalleOlaviNiemitalo

    params string[] args doesn't seem that useful here, anyway. Callers would usually have the args in a collection object already, except perhaps in tests where you can just do new[] { "…", … }.

  4. added this to the 2.0 GA milestone on Nov 9, 2022
  5. jonsequitur commented on Nov 11, 2022

    @jonsequitur
    ContributorAuthor

    params string[] args doesn't seem that useful here, anyway. Callers would usually have the args in a collection object already, except perhaps in tests where you can just do new[] { "…", … }.

    And we've been trying to discourage testing that way because it requires you to know how the command line input string will be split into an array of strings, which is not at all straightforward: #1758.

  6. KalleOlaviNiemitalo commented on Nov 11, 2022

    @KalleOlaviNiemitalo

    It's well understood for POSIX sh.

  7. adamsitnik commented on Nov 14, 2022

    @adamsitnik
    Member

    fixed in #1951

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

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions