Skip to content

Commit

Permalink
fix: remove shortnames for global options, to reduce conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
zachdaniel committed Jul 9, 2024
1 parent 913945b commit a6fb8ec
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
10 changes: 6 additions & 4 deletions lib/igniter/util/install.ex
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,19 @@ defmodule Igniter.Util.Install do
end)

global_options =
Igniter.Mix.Task.Info.global_options()
|> Keyword.update!(:switches, &Keyword.put(&1, :example, :boolean))
|> Keyword.update!(:aliases, &Keyword.put(&1, :e, :example))
Keyword.update!(
Igniter.Mix.Task.Info.global_options(),
:switches,
&Keyword.put(&1, :example, :boolean)
)

{igniter, desired_tasks, {options, _}} =
Igniter.Util.Info.compose_install_and_validate!(
igniter,
argv,
%Igniter.Mix.Task.Info{
schema: global_options[:switches],
aliases: global_options[:aliases],
aliases: [],
installs: task_installs
},
"igniter.install"
Expand Down
8 changes: 2 additions & 6 deletions lib/mix/task.ex
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,8 @@ defmodule Igniter.Mix.Task do
yes: :boolean,
check: :boolean
],
aliases: [
d: :dry_run,
y: :yes,
c: :check
]
# no aliases for global options!
aliases: []
]

defstruct schema: [],
Expand Down Expand Up @@ -97,7 +94,6 @@ defmodule Igniter.Mix.Task do
|> info(nil)
|> Kernel.||(%Info{})
|> Map.update!(:schema, &Keyword.merge(&1, global_options[:switches]))
|> Map.update!(:aliases, &Keyword.merge(&1, global_options[:aliases]))

{opts, _} =
Igniter.Util.Info.validate!(argv, info, Mix.Task.task_name(__MODULE__))
Expand Down
6 changes: 3 additions & 3 deletions lib/mix/tasks/igniter.install.ex
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ defmodule Mix.Tasks.Igniter.Install do
## Switches
* `--dry-run` - `d` - Run the task without making any changes.
* `--yes` - `y` - Automatically answer yes to any prompts.
* `--example` - `e` - Request that installed packages include initial example code.
* `--dry-run` - Run the task without making any changes.
* `--yes` - Automatically answer yes to any prompts.
* `--example` - Request that installed packages include initial example code.
"""
use Mix.Task

Expand Down

0 comments on commit a6fb8ec

Please sign in to comment.