Truly - Create a truth table to consolidate complex boolean conditional logic.

That’s cool, but you could also just use the format-table directive of the Elixir formatter.

@format(:table)
[
  {:DMS,          :ARE_FRIENDS, :tag,          :msg                                       },
  {:friends_only, false,        :error,        "You Must Be Friends to Message This User" },
  {:friends_only, true,         :send_message, nil                                        },
  {:public,       false,        :send_message, nil                                        },
  {:public,       true,         :send_message, nil                                        },
  {:closed,       true,         :error,        "This User Does Not Accept Direct Messages"},
  {:closed,       false,        :error,        "This User Does Not Accept Direct Messages"},
]

Just kidding, the formatter can’t do that.
But wouldn’t it be cool?
Until then I’ll use your lib, though it is a little crazy.

Clang-Format Style Options — Clang 14.0.0 documentation (AlignArrayOfStructures)

2 Likes