Skip to content

Commit

Permalink
Support passing repeated args as comma separated list
Browse files Browse the repository at this point in the history
  • Loading branch information
pnezis committed Oct 18, 2024
1 parent ab0ea27 commit 81672d5
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
6 changes: 6 additions & 0 deletions workspace/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

* `workspace.list`: support filtering by root paths through the `--path` flag.
* `workspace.run`: support filtering by root paths through the `--path` flag.
* Support passing most repeated CLI arguments as a comma separated list, for
example you can now do:

```bash
$ mix workspace.run -t format -p p1,p2,p3
```

### Fixed

Expand Down
3 changes: 2 additions & 1 deletion workspace/lib/mix/tasks/workspace.run.ex
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ defmodule Mix.Tasks.Workspace.Run do
doc: """
Allow the task for this specific project to fail. Can be set more than once.
""",
multiple: true
multiple: true,
separator: ","
],
early_stop: [
type: :boolean,
Expand Down
4 changes: 4 additions & 0 deletions workspace/lib/workspace/cli_options.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ defmodule Workspace.CliOptions do
project: [
type: :string,
multiple: true,
separator: ",",
short: "p",
doc:
"The project name, can be defined multiple times. If not set all projects are considered",
Expand All @@ -15,6 +16,7 @@ defmodule Workspace.CliOptions do
type: :string,
short: "e",
multiple: true,
separator: ",",
doc: "Ignore the given projects",
doc_section: :filtering
],
Expand All @@ -32,6 +34,7 @@ defmodule Workspace.CliOptions do
type: :string,
multiple: true,
long: "tag",
separator: ",",
doc: """
If set, only projects with the given tag(s) will be considered. For scoped tags you should
provide a colon separated string (examples: `shared`, `scope:api`, `type:utils`). For
Expand All @@ -58,6 +61,7 @@ defmodule Workspace.CliOptions do
excluded_tags: [
type: :string,
multiple: true,
separator: ",",
long: "exclude-tag",
doc: """
If set, any projects with any of the given tag(s) will be excluded. For scoped tags you should
Expand Down
2 changes: 1 addition & 1 deletion workspace/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ defmodule Workspace.MixProject do
defp deps do
[
{:cli_options, path: "../cli_options/"},
# {:cli_options, "~> 0.1.2"},
# {:cli_options, "~> 0.1.3"},
{:nimble_options, "~> 1.1.1"},
{:jason, "~> 1.4.1", optional: true},
{:ex_doc, "== 0.34.2", only: :dev, runtime: false},
Expand Down
4 changes: 1 addition & 3 deletions workspace/test/mix/tasks/workspace.run_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,7 @@ defmodule Mix.Tasks.Workspace.RunTest do
test "if execution on a project fails the command raises" do
args = [
"-p",
"package_default_a",
"-p",
"package_default_b",
"package_default_a,package_default_b",
"-t",
"cmd",
"--workspace-path",
Expand Down

0 comments on commit 81672d5

Please sign in to comment.