-
Notifications
You must be signed in to change notification settings - Fork 172
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
Use space-separated paths instead of comma-separated #551
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I like this change. I wish it had worked this way from the start. Could you update the readme docs that use these options to match the new syntax as part of this PR. |
@JoeRobich, updated the readme to reflect changes. :) |
JoeRobich
approved these changes
Feb 16, 2020
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.
Thanks for this change!
am11
commented
Feb 16, 2020
am11
added a commit
to am11/format
that referenced
this pull request
Aug 29, 2020
Today, `dotnet-format` accepts space-separated list of files. This allows us to pass files via shell's native globbing expansion, heredoc style redirections as well as via pipelines (see dotnet#551 for examples). However, in case of pipeline it requires a second utility (`xarg`) to transform pipeline input as space-separated list to `dotnet-format`. This PR implements native pipeline reading support for `--include` and `--exclude` options, while keeping the space-separated list intact. Usage examples: 1. Include all C# source files under `tests/Utilities` directory that are in git source tree: ```sh git ls-files :/tests/Utilities/*.cs | dotnet format --include - --folder ``` 2. Exclude certain `*.cs` and `*.vb` files using `ls(1)`: ```sh ls ../../../../../src/generated/{*.cs,*.vb} | dotnet format --exclude /dev/stdin --folder ``` Rules: * Based on Guideline 13 of [IEEE 1003.1-2017](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02) (POSIX), it accepts `-` as an explicit marker for stdin with addition of: * `/dev/stdin` - which is a universal synonym of `-` on all Unices. * It *only* accepts explicit markers (`/dev/stdin` or `-`) and does not implicit deduce the output if standard input was redirected, but marker was not present. This is because our usage is multi-purpose (both `--include` and `--exclude`). * It is an error if both `--include` and `--exclude` are using stdin marker (`/dev/stdin` or `-`). Limitation: * Currently, it reads the entire input from pipeline in `include`/`exclude` buffer, and then runs the operation on the whole batch. In order to make the pipele , it would require some refactorings; so files `yield return` and enumerator dispatches format operation per file. * At present, we do not have out-of-process functional tests for CLI to effectively validate these kind of use-cases (redirection and shell globbing vs. dotnet-format's built-in globbing support); so PR did not included any new mechanism.
am11
added a commit
to am11/format
that referenced
this pull request
Aug 29, 2020
Today, `dotnet-format` accepts space-separated list of files. This allows us to pass files via shell's native globbing expansion, heredoc style redirections as well as via pipelines (see dotnet#551 for examples). However, in case of pipeline it requires a second utility (`xarg`) to transform pipeline input as space-separated list to `dotnet-format`. This PR implements native pipeline reading support for `--include` and `--exclude` options, while keeping the space-separated list intact. Usage examples: 1. Include all C# source files under `tests/Utilities` directory that are in git source tree: ```sh git ls-files :/tests/Utilities/*.cs | dotnet format --include - --folder ``` 2. Exclude certain `*.cs` and `*.vb` files using `ls(1)`: ```sh ls ../../../../../src/generated/{*.cs,*.vb} | dotnet format --exclude /dev/stdin --folder ``` Rules: * Based on Guideline 13 of [IEEE 1003.1-2017](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02) (POSIX), it accepts `-` as an explicit marker for stdin with addition of: * `/dev/stdin` - which is a universal synonym of `-` on all Unices. * It *only* accepts explicit markers (`/dev/stdin` or `-`) and does not implicit deduce the output if standard input was redirected, but marker was not present. This is because our usage is multi-purpose (both `--include` and `--exclude`). * It is an error if both `--include` and `--exclude` are using stdin marker (`/dev/stdin` or `-`). Limitations: * Currently, it reads the entire input from pipeline in `include`/`exclude` buffer, and then runs the operation on the whole batch. In order to make the pipele , it would require some refactorings; so files `yield return` and enumerator dispatches format operation per file. * At present, we do not have out-of-process functional tests for CLI to effectively validate these kind of use-cases (redirection and shell globbing vs. dotnet-format's built-in globbing support); so PR did not included any new mechanism.
am11
added a commit
to am11/format
that referenced
this pull request
Aug 29, 2020
Today, `dotnet-format` accepts space-separated list of files. This allows us to pass files via shell's native globbing expansion, heredoc style redirections as well as via pipelines (see dotnet#551 for examples). However, in case of pipeline it requires a second utility (`xarg`) to transform pipeline input as space-separated list to `dotnet-format`. This PR implements native pipeline reading support for `--include` and `--exclude` options, while keeping the space-separated list intact. Usage examples: 1. Include all C# source files under `tests/Utilities` directory that are in git source tree: ```sh git ls-files :/tests/Utilities/*.cs | dotnet format --include - --folder ``` 2. Exclude certain `*.cs` and `*.vb` files using `ls(1)`: ```sh ls ../../../../../src/generated/{*.cs,*.vb} | dotnet format --exclude /dev/stdin --folder ``` Rules: * Based on Guideline 13 of [IEEE 1003.1-2017](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02) (POSIX), it accepts `-` as an explicit marker for stdin with addition of: * `/dev/stdin` - which is a universal synonym of `-` on all Unices. * It *only* accepts explicit markers (`/dev/stdin` or `-`) and does not implicit deduce the output if standard input was redirected, but marker was not present. This is because our usage is multi-purpose (both `--include` and `--exclude`). * It is an error if both `--include` and `--exclude` are using stdin marker (`/dev/stdin` or `-`). Limitation: * Currently, it reads the entire input from pipeline in `include`/`exclude` buffer, and then runs the operation on the whole batch. In order to make the pipele , it would require some refactorings; so files `yield return` and enumerator dispatches format operation per file. * At present, we do not have out-of-process functional tests for CLI to effectively validate these kind of use-cases (redirection and shell globbing vs. dotnet-format's built-in globbing support); so PR did not included any new mechanism.
am11
added a commit
to am11/format
that referenced
this pull request
Aug 29, 2020
Today, `dotnet-format` accepts space-separated list of files. This allows us to pass files via shell's native globbing expansion, heredoc style redirections as well as via pipelines (see dotnet#551 for examples). However, in case of pipeline it requires a second utility (`xarg`) to transform pipeline input as space-separated list to `dotnet-format`. This PR implements native pipeline reading support for `--include` and `--exclude` options, while keeping the space-separated list intact. Usage examples: 1. Include all C# source files under `tests/Utilities` directory that are in git source tree: ```sh git ls-files :/tests/Utilities/*.cs | dotnet format --include - --folder ``` 2. Exclude certain `*.cs` and `*.vb` files using `ls(1)`: ```sh ls ../../../../../src/generated/{*.cs,*.vb} | dotnet format --exclude /dev/stdin --folder ``` Rules: * Based on Guideline 13 of [IEEE 1003.1-2017](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02) (POSIX), it accepts `-` as an explicit marker for stdin with addition of: * `/dev/stdin` - which is a universal synonym of `-` on all Unices. * It *only* accepts explicit markers (`/dev/stdin` or `-`) and does not implicit deduce the output if standard input was redirected, but marker was not present. This is because our usage is multi-purpose (both `--include` and `--exclude`). * It is an error if both `--include` and `--exclude` are using stdin marker (`/dev/stdin` or `-`). Limitation: * Currently, it reads the entire input from pipeline in `include`/`exclude` buffer, and then runs the operation on the whole batch. In order to make the pipele , it would require some refactorings; so files `yield return` and enumerator dispatches format operation per file. * At present, we do not have out-of-process functional tests for CLI to effectively validate these kind of use-cases (redirection and shell globbing vs. dotnet-format's built-in globbing support); so PR did not included any new mechanism.
am11
added a commit
to am11/format
that referenced
this pull request
Aug 30, 2020
Today, `dotnet-format` accepts space-separated list of files. This allows us to pass files via shell's native globbing expansion, heredoc style redirections as well as via pipelines (see dotnet#551 for examples). However, in case of pipeline it requires a second utility (`xarg`) to transform pipeline input as space-separated list to `dotnet-format`. This PR implements native pipeline reading support for `--include` and `--exclude` options, while keeping the space-separated list intact. Usage examples: 1. Include all C# source files under `tests/Utilities` directory that are in git source tree: ```sh git ls-files :/tests/Utilities/*.cs | dotnet format --include - --folder ``` 2. Exclude certain `*.cs` and `*.vb` files using `ls(1)`: ```sh ls ../../../../../src/generated/{*.cs,*.vb} | dotnet format --exclude /dev/stdin --folder ``` Rules: * Based on Guideline 13 of [IEEE 1003.1-2017](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02) (POSIX), it accepts `-` as an explicit marker for stdin with addition of: * `/dev/stdin` - which is a universal synonym of `-` on all Unices. * It *only* accepts explicit markers (`/dev/stdin` or `-`) and does not implicit deduce the output if standard input was redirected, but marker was not present. This is because our usage is multi-purpose (both `--include` and `--exclude`). * It is an error if both `--include` and `--exclude` are using stdin marker (`/dev/stdin` or `-`). Limitation: * Currently, it reads the entire input from pipeline in `include`/`exclude` buffer, and then runs the operation on the whole batch. In order to make the pipele , it would require some refactorings; so files `yield return` and enumerator dispatches format operation per file. * At present, we do not have out-of-process functional tests for CLI to effectively validate these kind of use-cases (redirection and shell globbing vs. dotnet-format's built-in globbing support); so PR did not included any new mechanism.
am11
added a commit
to am11/format
that referenced
this pull request
Aug 30, 2020
Today, `dotnet-format` accepts space-separated list of files. This allows us to pass files via shell's native globbing expansion, heredoc style redirections as well as via pipelines (see dotnet#551 for examples). However, in case of pipeline it requires a second utility (`xarg`) to transform pipeline input as space-separated list to `dotnet-format`. This PR implements native pipeline reading support for `--include` and `--exclude` options, while keeping the space-separated list intact. Usage examples: 1. Include all C# source files under `tests/Utilities` directory that are in git source tree: ```sh git ls-files :/tests/Utilities/*.cs | dotnet format --include - --folder ``` 2. Exclude certain `*.cs` and `*.vb` files using `ls(1)`: ```sh ls ../../../../../src/generated/{*.cs,*.vb} | dotnet format --exclude /dev/stdin --folder ``` Rules: * Based on Guideline 13 of [IEEE 1003.1-2017](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02) (POSIX), it accepts `-` as an explicit marker for stdin with addition of: * `/dev/stdin` - which is a universal synonym of `-` on all Unices. * It *only* accepts explicit markers (`/dev/stdin` or `-`) and does not implicit deduce the output if standard input was redirected, but marker was not present. This is because our usage is multi-purpose (both `--include` and `--exclude`). * It is an error if both `--include` and `--exclude` are using stdin marker (`/dev/stdin` or `-`). Limitations: * Currently, it reads the entire input from pipeline in `include`/`exclude` buffer, and then runs the operation on the whole batch. In order to make the pipele , it would require some refactorings; so files `yield return` and enumerator dispatches format operation per file. * At present, we do not have out-of-process functional tests for CLI to effectively validate these kind of use-cases (redirection and shell globbing vs. dotnet-format's built-in globbing support); so PR did not included any new mechanism.
am11
added a commit
to am11/format
that referenced
this pull request
Aug 30, 2020
Today, `dotnet-format` accepts space-separated list of files. This allows us to pass files via shell's native globbing expansion, heredoc style redirections as well as via pipelines (see dotnet#551 for examples). However, in case of pipeline it requires a second utility (`xarg`) to transform pipeline input as space-separated list to `dotnet-format`. This PR implements native pipeline reading support for `--include` and `--exclude` options, while keeping the space-separated list intact. Usage examples: 1. Include all C# source files under `tests/Utilities` directory that are in git source tree: ```sh git ls-files :/tests/Utilities/*.cs | dotnet format --include - --folder ``` 2. Format all C# source files in last commit: ```sh git show --name-only --pretty="" | dotnet format --include - --folder ``` 2. Exclude certain `*.cs` and `*.vb` files using `ls(1)`: ```sh ls ../../../../../src/generated/{*.cs,*.vb} | dotnet format --exclude /dev/stdin --folder ``` Rules: * Based on Guideline 13 of [IEEE 1003.1-2017](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02) (POSIX), it accepts `-` as an explicit marker for stdin with addition of: * `/dev/stdin` - which is a universal synonym of `-` on all Unices. * It *only* accepts explicit markers (`/dev/stdin` or `-`) and does not implicit deduce the output if standard input was redirected, but marker was not present. This is because our usage is multi-purpose (both `--include` and `--exclude`). * It is an error if both `--include` and `--exclude` are using stdin marker (`/dev/stdin` or `-`). Limitations: * Currently, it reads the entire input from pipeline in `include`/`exclude` buffer, and then runs the operation on the whole batch. In order to make the pipele , it would require some refactorings; so files `yield return` and enumerator dispatches format operation per file. * At present, we do not have out-of-process functional tests for CLI to effectively validate these kind of use-cases (redirection and shell globbing vs. dotnet-format's built-in globbing support); so PR did not included any new mechanism.
am11
added a commit
to am11/format
that referenced
this pull request
Aug 30, 2020
Today, `dotnet-format` accepts space-separated list of files. This allows us to pass files via shell's native globbing expansion, heredoc style redirections as well as via pipelines (see dotnet#551 for examples). However, in case of pipeline it requires a second utility (`xarg`) to transform pipeline input as space-separated list to `dotnet-format`. This PR implements native pipeline reading support for `--include` and `--exclude` options, while keeping the space-separated list intact. Usage examples: 1. Include all C# source files under `tests/Utilities` directory that are in git source tree: ```sh git ls-files :/tests/Utilities/*.cs | dotnet format --include - --folder ``` 3. Format all C# source files in last commit: ```sh git show --name-only --pretty="" | dotnet format --include - --folder ``` 2. Exclude certain `*.cs` and `*.vb` files using `ls(1)`: ```sh ls ../../../../../src/generated/{*.cs,*.vb} | dotnet format --exclude /dev/stdin --folder ``` Rules: * Based on Guideline 13 of [IEEE 1003.1-2017](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02) (POSIX), it accepts `-` as an explicit marker for stdin with addition of: * `/dev/stdin` - which is a universal synonym of `-` on all Unices. * It *only* accepts explicit markers (`/dev/stdin` or `-`) and does not implicit deduce the output if standard input was redirected, but marker was not present. This is because our usage is multi-purpose (both `--include` and `--exclude`). * It is an error if both `--include` and `--exclude` are using stdin marker (`/dev/stdin` or `-`). Limitations: * Currently, it reads the entire input from pipeline in `include`/`exclude` buffer, and then runs the operation on the whole batch. In order to make the pipele , it would require some refactorings; so files `yield return` and enumerator dispatches format operation per file. * At present, we do not have out-of-process functional tests for CLI to effectively validate these kind of use-cases (redirection and shell globbing vs. dotnet-format's built-in globbing support); so PR did not included any new mechanism.
am11
added a commit
to am11/format
that referenced
this pull request
Aug 30, 2020
Today, `dotnet-format` accepts space-separated list of files. This allows us to pass files via shell's native globbing expansion, heredoc style redirections as well as via pipelines (see dotnet#551 for examples). However, in case of pipeline it requires a second utility (`xarg`) to transform pipeline input as space-separated list to `dotnet-format`. This PR implements native pipeline reading support for `--include` and `--exclude` options, while keeping the space-separated list intact. Usage examples: 1. Include all C# source files under `tests/Utilities` directory that are in git source tree: ```sh git ls-files :/tests/Utilities/*.cs | dotnet format --include - --folder ``` 3. Format all C# source files in last commit: ```sh git show --name-only --pretty="" | dotnet format --include - --folder ``` 2. Exclude certain `*.cs` and `*.vb` files using `ls(1)`: ```sh ls ../../../../../src/generated/{*.cs,*.vb} | dotnet format --exclude /dev/stdin --folder ``` Rules: * Based on Guideline 13 of [IEEE 1003.1-2017](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02) (POSIX), it accepts `-` as an explicit marker for stdin with addition of: * `/dev/stdin` - which is a universal synonym of `-` on all Unices. * It *only* accepts explicit markers (`/dev/stdin` or `-`) and does not implicitly deduce the output if standard input was redirected, but marker was not present. This is because our usage is multi-purpose (both `--include` and `--exclude`). * It is an error if both `--include` and `--exclude` are using stdin marker (`/dev/stdin` or `-`). Limitations: * Currently, it reads the entire input from pipeline in `include`/`exclude` buffer, and then runs the operation on the whole batch. In order to make the pipele , it would require some refactorings; so files `yield return` and enumerator dispatches format operation per file. * At present, we do not have out-of-process functional tests for CLI to effectively validate these kind of use-cases (redirection and shell globbing vs. dotnet-format's built-in globbing support); so PR did not included any new mechanism.
am11
added a commit
to am11/format
that referenced
this pull request
Aug 30, 2020
Today, `dotnet-format` accepts space-separated list of files. This allows us to pass files via shell's native globbing expansion, heredoc style redirections as well as via pipelines (see dotnet#551 for examples). However, in case of pipeline it requires a second utility (`xarg`) to transform pipeline input as space-separated list to `dotnet-format`. This PR implements native pipeline reading support for `--include` and `--exclude` options, while keeping the space-separated list intact. Usage examples: 1. Include all C# source files under `tests/Utilities` directory that are in git source tree: ```sh git ls-files :/tests/Utilities/*.cs | dotnet format --include - --folder ``` 3. Format all C# source files in last commit: ```sh git show --name-only --pretty="" | dotnet format --include - --folder ``` 2. Exclude certain `*.cs` and `*.vb` files using `ls(1)`: ```sh ls ../../../../../src/generated/{*.cs,*.vb} | dotnet format --exclude /dev/stdin --folder ``` Rules: * Based on Guideline 13 of [IEEE 1003.1-2017](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02) (POSIX), it accepts `-` as an explicit marker for stdin with addition of: * `/dev/stdin` - which is a universal synonym of `-` on all Unices. * It *only* accepts explicit markers (`/dev/stdin` or `-`) and does not implicitly deduce the output if standard input was redirected, but marker was not present. This is because our usage is multi-purpose (both `--include` and `--exclude`). * It is an error if both `--include` and `--exclude` are using stdin marker (`/dev/stdin` or `-`). Limitations: * Currently, it reads the entire input from pipeline in `include`/`exclude` buffer, and then runs the operation on the whole batch. In order to make the pipele , it would require some refactorings; so files are `yield return` and enumerator can dispatch format operation per file. * At present, we do not have out-of-process functional tests for CLI to effectively validate these kind of use-cases (redirection and shell globbing vs. dotnet-format's built-in globbing support); so PR did not included any new mechanism.
am11
added a commit
to am11/format
that referenced
this pull request
Aug 30, 2020
Today, `dotnet-format` accepts space-separated list of files. This allows us to pass files via shell's native globbing expansion, heredoc style redirections as well as via pipelines (see dotnet#551 for examples). However, in case of pipeline it requires a second utility (`xarg`) to transform pipeline input as space-separated list to `dotnet-format`. This PR implements native pipeline reading support for `--include` and `--exclude` options, while keeping the space-separated list intact. Usage examples: 1. Include all C# source files under `tests/Utilities` directory that are in git source tree: ```sh git ls-files :/tests/Utilities/*.cs | dotnet format --include - --folder ``` 3. Format all C# source files in last commit: ```sh git show --name-only --pretty="" | dotnet format --include - --folder ``` 2. Exclude certain `*.cs` and `*.vb` files using `ls(1)`: ```sh ls ../../../../../src/generated/{*.cs,*.vb} | dotnet format --exclude /dev/stdin --folder ``` Rules: * Based on Guideline 13 of [IEEE 1003.1-2017](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02) (POSIX), it accepts `-` as an explicit marker for stdin with addition of: * `/dev/stdin` - which is a universal synonym of `-` on all Unices. * It *only* accepts explicit markers (`/dev/stdin` or `-`) and does not implicitly deduce the output if standard input was redirected, but marker was not present. This is because our usage is multi-purpose (both `--include` and `--exclude`). * It is an error if both `--include` and `--exclude` are using stdin marker (`/dev/stdin` or `-`). Limitations: * Currently, it reads the entire input from pipeline in `include`/`exclude` buffer, and then runs the operation on the whole batch. In order to make it true pipeline friendly, it would require some refactoring; so files are `yield return`ed and enumerator can dispatch format operation per file. * At present, we do not have out-of-process functional tests for CLI to effectively validate these kind of use-cases (redirection and shell globbing vs. dotnet-format's built-in globbing support); so PR did not included any new mechanism.
am11
added a commit
to am11/format
that referenced
this pull request
Aug 30, 2020
Today, `dotnet-format` accepts space-separated list of files. This allows us to pass files via shell's native globbing expansion, heredoc style redirections as well as via pipelines (see dotnet#551 for examples). However, in case of pipeline it requires a second utility (`xarg`) to transform pipeline input as space-separated list to `dotnet-format`. This PR implements native pipeline reading support for `--include` and `--exclude` options, while keeping the space-separated list intact. Usage examples: 1. Include all C# source files under `tests/Utilities` directory that are in git source tree: ```sh git ls-files :/tests/Utilities/*.cs | dotnet format --include - --folder ``` 3. Format all C# source files in last commit: ```sh git show --name-only --pretty="" | dotnet format --include - --folder ``` 2. Exclude certain `*.cs` and `*.vb` files using `ls(1)`: ```sh ls ../../../../../src/generated/{*.cs,*.vb} | dotnet format --exclude /dev/stdin --folder ``` Rules: * Based on Guideline 13 of [IEEE 1003.1-2017](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02) (POSIX), it accepts `-` as an explicit marker for stdin with addition of: * `/dev/stdin` - which is a universal synonym of `-` on all Unices. * It *only* accepts explicit markers (`/dev/stdin` or `-`) and does not implicitly deduce the output if standard input was redirected, but marker was not present. This is because our usage is multi-purpose (both `--include` and `--exclude`). * It is an error if both `--include` and `--exclude` are using stdin marker (`/dev/stdin` or `-`). Limitations: * Currently, it reads the entire input from pipeline in `include`/`exclude` buffer, and then runs the operation on the whole batch. In order to make it true pipeline friendly, it would require some refactoring; so files are `yield return`ed and enumerator can dispatch format operation per file. * At present, we do not have out-of-process functional tests for CLI to effectively validate these kind of use-cases (redirection and shell globbing vs. dotnet-format's built-in globbing support); so PR did not included any new mechanism.
am11
added a commit
to am11/format
that referenced
this pull request
Aug 30, 2020
Today, `dotnet-format` accepts space-separated list of files. This allows us to pass files via shell's native globbing expansion, heredoc style redirections as well as via pipelines (see dotnet#551 for examples). However, in case of pipeline it requires a second utility (`xarg`) to transform pipeline input as space-separated list to `dotnet-format`. This PR implements native pipeline reading support for `--include` and `--exclude` options, while keeping the space-separated list intact. Usage examples: 1. Include all C# source files under `tests/Utilities` directory that are in git source tree: ```sh git ls-files :/tests/Utilities/*.cs | dotnet format --include - --folder ``` 3. Format all C# source files in last commit: ```sh git show --name-only --pretty="" | dotnet format --include - --folder ``` 2. Exclude certain `*.cs` and `*.vb` files using `ls(1)`: ```sh ls ../../../../../src/generated/{*.cs,*.vb} | dotnet format --exclude /dev/stdin --folder ``` Rules: * Based on Guideline 13 of [IEEE 1003.1-2017](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02) (POSIX), it accepts `-` as an explicit marker for stdin with addition of: * `/dev/stdin` - which is a universal synonym of `-` on all Unices. * It *only* accepts explicit markers (`/dev/stdin` or `-`) and does not implicitly deduce the output if standard input was redirected, but marker was not present. This is because our usage is multi-purpose (both `--include` and `--exclude`). * It is an error if both `--include` and `--exclude` are using stdin marker (`/dev/stdin` or `-`). Limitations / future considerations: * Currently, it reads the entire input from pipeline in `include`/`exclude` buffer, and then runs the operation on the whole batch. In order to make it true pipeline friendly, it would require some refactoring; so files are `yield return`ed and enumerator can dispatch format operation per file. * At present, we do not have out-of-process functional tests for CLI to effectively validate these kind of use-cases (redirection and shell globbing vs. dotnet-format's built-in globbing support); so PR did not included any new mechanism.
am11
added a commit
to am11/format
that referenced
this pull request
Aug 30, 2020
Today, `dotnet-format` accepts space-separated list of files. This allows us to pass files via shell's native globbing expansion, heredoc style redirections as well as via pipelines (see dotnet#551 for examples). However, in case of pipeline it requires a second utility (`xarg`) to transform pipeline input as space-separated list to `dotnet-format`. This PR implements native pipeline reading support for `--include` and `--exclude` options, while keeping the space-separated list intact. #### Usage examples 1. Include all C# source files under `tests/Utilities` directory that are in git source tree: ```sh git ls-files :/tests/Utilities/*.cs | dotnet format --include - --folder ``` 3. Format all C# source files in last commit: ```sh git show --name-only --pretty="" | dotnet format --include - --folder ``` 2. Exclude certain `*.cs` and `*.vb` files using `ls(1)`: ```sh ls ../../../../../src/generated/{*.cs,*.vb} | dotnet format --exclude /dev/stdin --folder ``` #### Rules * Based on Guideline 13 of [IEEE 1003.1-2017](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02) (POSIX), it accepts `-` as an explicit marker for stdin with addition of: * `/dev/stdin` - which is a universal synonym of `-` on all Unices. * It *only* accepts explicit markers (`/dev/stdin` or `-`) and does not implicitly deduce the output if standard input was redirected, but marker was not present. This is because our usage is multi-purpose (both `--include` and `--exclude`). * It is an error if both `--include` and `--exclude` are using stdin marker (`/dev/stdin` or `-`). #### Limitations / future considerations * Currently, it reads the entire input from pipeline in `include`/`exclude` buffer, and then runs the operation on the whole batch. In order to make it true pipeline friendly, it would require some refactoring; so files are `yield return`ed and enumerator can dispatch format operation per file. * At present, we do not have out-of-process functional tests for CLI to effectively validate these kind of use-cases (redirection and shell globbing vs. dotnet-format's built-in globbing support); so PR did not included any new mechanism.
am11
added a commit
to am11/format
that referenced
this pull request
Aug 30, 2020
Today, `dotnet-format` accepts space-separated list of files. This allows us to pass files via shell's native globbing expansion, heredoc style redirections as well as via pipelines (see dotnet#551 for examples). However, in case of pipeline it requires a second utility (`xarg`) to transform pipeline input as space-separated list to `dotnet-format`. This PR implements native pipeline reading support for `--include` and `--exclude` options, while keeping the space-separated list intact. #### Usage examples 1. Include all C# source files under `tests/Utilities` directory that are in git source tree: ```sh git ls-files :/tests/Utilities/*.cs | dotnet format --include - --folder ``` 3. Format all C# source files in last commit: ```sh git show --name-only --pretty="" | dotnet format --include - --folder ``` 2. Exclude certain `*.cs` and `*.vb` files using `ls(1)`: ```sh ls ../../../../../src/generated/{*.cs,*.vb} | dotnet format --exclude /dev/stdin --folder ``` #### Rules * Based on Guideline 13 of [IEEE 1003.1-2017](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02) (POSIX), it accepts `-` as an explicit marker for stdin with addition of: * `/dev/stdin` - which is a universal synonym of `-` on all Unices. * It *only* accepts explicit markers (`/dev/stdin` or `-`) and does not implicitly deduce the output if standard input was redirected, but marker was not present. This is because our usage is multi-purpose (both `--include` and `--exclude`). * It is an error if both `--include` and `--exclude` are using stdin marker (`/dev/stdin` or `-`). #### Limitations / future considerations * Currently, it reads the entire input from pipeline in `include`/`exclude` buffer, and then runs the operation on the whole batch. In order to make it true pipeline friendly, it would require some refactoring; so files are `yield return`'d and enumerator can dispatch format operation per file. * At present, we do not have out-of-process functional tests for CLI to effectively validate these kind of use-cases (redirection and shell globbing vs. dotnet-format's built-in globbing support); so PR did not included any new mechanism.
am11
added a commit
to am11/format
that referenced
this pull request
Aug 30, 2020
Today, `dotnet-format` accepts space-separated list of files. This allows us to pass files via shell's native globbing expansion, heredoc style redirections as well as via pipelines (see dotnet#551 for examples). However, in case of pipeline it requires a second utility (`xarg`) to transform pipeline input as space-separated list to `dotnet-format`. This PR implements native pipeline reading support for `--include` and `--exclude` options, while keeping the space-separated list intact. #### Usage examples 1. Include all C# source files under `tests/Utilities` directory that are in git source tree: ```sh git ls-files :/tests/Utilities/*.cs | dotnet format --include - --folder ``` 3. Format all C# source files in last commit: ```sh git show --name-only --pretty="" | dotnet format --include - --folder ``` 2. Exclude certain `*.cs` and `*.vb` files using `ls(1)`: ```sh ls ../../../../../src/generated/{*.cs,*.vb} | dotnet format --exclude /dev/stdin --folder ``` #### Rules * Based on Guideline 13 of [IEEE 1003.1-2017](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02) (POSIX), it accepts `-` as an explicit marker for stdin with addition of: * `/dev/stdin` - which is a universal synonym of `-` on all Unices. * It *only* accepts explicit markers (`/dev/stdin` or `-`) and does not implicitly deduce the output if standard input was redirected, but marker was not present. This is because our usage is multi-purpose (both `--include` and `--exclude`). * It is an error if both `--include` and `--exclude` are using stdin marker (`/dev/stdin` or `-`). #### Limitations / future considerations * Currently, it reads the entire input from pipeline in `include`/`exclude` buffer, and then runs the operation on the whole batch. In order to make it true pipeline friendly, it would require some refactoring; so files are `yield return`'d and enumerator can dispatch format operation per file. * At present, we do not have out-of-process functional test mechanism for CLI to effectively validate these kind of use-cases (redirection and shell globbing vs. dotnet-format's built-in globbing support); so no tests are included in this PR.
am11
added a commit
to am11/format
that referenced
this pull request
Aug 30, 2020
Today, `dotnet-format` accepts space-separated list of files. This allows us to pass files via shell's native globbing expansion, heredoc style redirections as well as via pipelines (see dotnet#551 for examples). However, in case of pipeline it requires a second utility (`xarg`) to transform pipeline input as space-separated list to `dotnet-format`. This PR implements native pipeline reading support for `--include` and `--exclude` options, while keeping the space-separated list intact. #### Usage examples 1. Include all C# source files under `tests/Utilities` directory that are in git source tree: ```sh git ls-files :/tests/Utilities/*.cs | dotnet format --include - --folder ``` 3. Format all C# source files in last commit: ```sh git show --name-only --pretty="" | dotnet format --include - --folder ``` 2. Exclude certain `*.cs` and `*.vb` files using `ls(1)`: ```sh ls ../../../../../src/generated/{*.cs,*.vb} | dotnet format --exclude /dev/stdin --folder ``` #### Rules * Based on Guideline 13 of [IEEE 1003.1-2017](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02) (POSIX), it accepts `-` as an explicit marker for stdin with addition of: * `/dev/stdin` - which is a universal synonym of `-` on all Unices. * It *only* accepts explicit markers (`/dev/stdin` or `-`) and does not implicitly deduce the output if standard input was redirected, but marker was not present. This is because our usage is multi-purpose (both `--include` and `--exclude`). * It is an error if both `--include` and `--exclude` are using stdin marker (`/dev/stdin` or `-`). #### Limitations / future considerations * Currently, it reads the entire input from pipeline in `include`/`exclude` buffer, and then runs the operation on the whole batch. In order to make it true pipeline friendly, it would require some refactoring; so files are `yield return`'d and enumerator can dispatch format operation per file. * At present, we do not have out-of-process functional test mechanism for CLI to effectively validate these kind of use-cases (redirection and shell globbing vs. dotnet-format's built-in globbing support); so no tests are included in this PR.
am11
added a commit
to am11/format
that referenced
this pull request
Aug 30, 2020
Today, `dotnet-format` accepts space-separated list of files. This allows us to pass files via shell's native globbing expansion, heredoc style redirections as well as via pipelines (see dotnet#551 for examples). However, in case of pipeline it requires a second utility (`xarg`) to transform pipeline input as space-separated list to `dotnet-format`. This PR implements native pipeline reading support for `--include` and `--exclude` options, while keeping the space-separated list intact. #### Usage examples 1. Include all C# source files under `tests/Utilities` directory that are in git source tree: ```sh git ls-files :/tests/Utilities/*.cs | dotnet format --include - --folder ``` 3. Format all C# source files in last commit: ```sh git show --name-only --pretty="" | dotnet format --include - --folder ``` 2. Exclude certain `*.cs` and `*.vb` files using `ls(1)`: ```sh ls ../../../../../src/generated/{*.cs,*.vb} | dotnet format --exclude /dev/stdin --folder ``` #### Rules * Based on Guideline 13 of [IEEE 1003.1-2017](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02) (POSIX), it accepts `-` as an explicit marker for stdin with addition of: * `/dev/stdin` - which is a universal synonym of `-` on all Unices. * It *only* accepts explicit markers (`/dev/stdin` or `-`) and does not implicitly deduce the output if standard input was redirected, but marker was not present. This is because our usage is multi-purpose (both `--include` and `--exclude`). * It is an error if both `--include` and `--exclude` are using stdin marker (`/dev/stdin` or `-`). #### Limitations / future considerations * Currently, it reads the entire input from pipeline in `include`/`exclude` buffer, and then runs the operation on the whole batch. In order to make it true pipeline friendly, it would require some refactoring; so files are `yield return`'d and enumerator can dispatch format operation per file. * At present, we do not have out-of-process functional test mechanism for CLI to effectively validate these kind of use-cases (redirection and shell globbing vs. dotnet-format's built-in globbing support); so no tests are included in this PR.
am11
added a commit
to am11/format
that referenced
this pull request
Sep 9, 2020
Today, `dotnet-format` accepts space-separated list of files. This allows us to pass files via shell's native globbing expansion, heredoc style redirections as well as via pipelines (see dotnet#551 for examples). However, in case of pipeline it requires a second utility (`xarg`) to transform pipeline input as space-separated list to `dotnet-format`. This PR implements native pipeline reading support for `--include` and `--exclude` options, while keeping the space-separated list intact. #### Usage examples 1. Include all C# source files under `tests/Utilities` directory that are in git source tree: ```sh git ls-files :/tests/Utilities/*.cs | dotnet format --include - --folder ``` 3. Format all C# source files in last commit: ```sh git show --name-only --pretty="" | dotnet format --include - --folder ``` 2. Exclude certain `*.cs` and `*.vb` files using `ls(1)`: ```sh ls ../../../../../src/generated/{*.cs,*.vb} | dotnet format --exclude /dev/stdin --folder ``` #### Rules * Based on Guideline 13 of [IEEE 1003.1-2017](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02) (POSIX), it accepts `-` as an explicit marker for stdin with addition of: * `/dev/stdin` - which is a universal synonym of `-` on all Unices. * It *only* accepts explicit markers (`/dev/stdin` or `-`) and does not implicitly deduce the output if standard input was redirected, but marker was not present. This is because our usage is multi-purpose (both `--include` and `--exclude`). * It is an error if both `--include` and `--exclude` are using stdin marker (`/dev/stdin` or `-`). #### Limitations / future considerations * Currently, it reads the entire input from pipeline in `include`/`exclude` buffer, and then runs the operation on the whole batch. In order to make it true pipeline friendly, it would require some refactoring; so files are `yield return`'d and enumerator can dispatch format operation per file. * At present, we do not have out-of-process functional test mechanism for CLI to effectively validate these kind of use-cases (redirection and shell globbing vs. dotnet-format's built-in globbing support); so no tests are included in this PR.
am11
added a commit
to am11/format
that referenced
this pull request
Sep 9, 2020
Today, `dotnet-format` accepts space-separated list of files. This allows us to pass files via shell's native globbing expansion, heredoc style redirections as well as via pipelines (see dotnet#551 for examples). However, in case of pipeline it requires a second utility (`xarg`) to transform pipeline input as space-separated list to `dotnet-format`. This PR implements native pipeline reading support for `--include` and `--exclude` options, while keeping the space-separated list intact. #### Usage examples 1. Include all C# source files under `tests/Utilities` directory that are in git source tree: ```sh git ls-files :/tests/Utilities/*.cs | dotnet format --include - --folder ``` 3. Format all C# source files in last commit: ```sh git show --name-only --pretty="" | dotnet format --include - --folder ``` 2. Exclude certain `*.cs` and `*.vb` files using `ls(1)`: ```sh ls ../../../../../src/generated/{*.cs,*.vb} | dotnet format --exclude /dev/stdin --folder ``` #### Rules * Based on Guideline 13 of [IEEE 1003.1-2017](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02) (POSIX), it accepts `-` as an explicit marker for stdin with addition of: * `/dev/stdin` - which is a universal synonym of `-` on all Unices. * It *only* accepts explicit markers (`/dev/stdin` or `-`) and does not implicitly deduce the output if standard input was redirected, but marker was not present. This is because our usage is multi-purpose (both `--include` and `--exclude`). * It is an error if both `--include` and `--exclude` are using stdin marker (`/dev/stdin` or `-`). #### Limitations / future considerations * Currently, it reads the entire input from pipeline in `include`/`exclude` buffer, and then runs the operation on the whole batch. In order to make it true pipeline friendly, it would require some refactoring; so files are `yield return`'d and enumerator can dispatch format operation per file. * At present, we do not have out-of-process functional test mechanism for CLI to effectively validate these kind of use-cases (redirection and shell globbing vs. dotnet-format's built-in globbing support); so no tests are included in this PR.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
--files
option.Solution
Change the semantics of
--include
or--files
and--exclude
options fromcomma-separated
tospace-separated
.Now we can do things like
dotnet-format --files {src,test}/**/*.cs
orgit ls-files :/{src,tests}/*.cs | xargs dotnet-format --files
.Additional change
Change the output message to include full path to file, so we can distinguish the clashing files.