Module: Mailmate::CLI::VersionFlag Private
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
--version / -V, handled uniformly by every exe shim.
This exists so a CONSUMER can tell how old an installed mailmate is
without parsing help text or probing for a flag's side effects. That
matters because the CLIs are deliberately pass-through: an older
mm-send handed a flag it doesn't know forwards it to emate rather
than rejecting it, so "did this flag work?" is not a safe capability
probe — it can open a composer window instead of erroring. A version
string is the honest check.
Every shim calls this before dispatching, so the answer is available even from commands whose real work needs macOS or a running MailMate. test_exe_shims.rb asserts the coverage is total; a new shim that skips the call fails that test rather than silently becoming the one command that can't be version-probed.
Constant Summary collapse
- FLAGS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
%w[--version -V].freeze
Instance Method Summary collapse
-
#handle!(argv, name) ⇒ Object
private
Prints "
(mailmate X.Y.Z)" and exits 0 when the flag is present.
Instance Method Details
#handle!(argv, name) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Prints "
29 30 31 32 33 34 |
# File 'lib/mailmate/cli/version_flag.rb', line 29 def handle!(argv, name) return unless argv.any? { |a| FLAGS.include?(a) } $stdout.puts "#{name} (mailmate #{Mailmate::VERSION})" exit 0 end |