     cond do
       :boolean in kinds ->
         {true, kinds, t}
+
       :count in kinds ->
         {1, kinds, t}
+
       value_in_tail?(t) ->
         [h | t] = t
         {h, kinds, t}
+
       kinds == [] and strict? ->
         {nil, kinds, t}
+
       kinds == [] ->
         {true, kinds, t}
+
       true ->
         {nil, [:invalid], t}
     end

  defp store_option(dict, option, value, kinds) do
    cond do
      :count in kinds ->
        Keyword.update(dict, option, value, & &1 + 1)
      :keep in kinds ->
        [{option, value} | dict]
      true ->
        [{option, value} | Keyword.delete(dict, option)]
    end
  end

  defp tag_option("no-" <> option = original, %{switches: switches, allow_nonexistent_atoms?: allow_nonexistent_atoms?}) do
    cond do
      (negated = get_option_key(option, allow_nonexistent_atoms?)) && :boolean in List.wrap(switches[negated]) ->
        {:negated, negated}
      option_key = get_option_key(original, allow_nonexistent_atoms?) ->
        {:default, option_key}
      true ->
        :unknown
    end

  ## Helpers

  defp build_config(opts) do
    {switches, strict?} =
      cond do
        opts[:switches] && opts[:strict] ->
          raise ArgumentError, ":switches and :strict cannot be given together"

        switches = opts[:switches] ->
          {switches, false}

        strict = opts[:strict] ->
          {strict, true}

        true ->
          {[], false}
      end

    %{
      aliases: opts[:aliases] || [],
