Discussions of development and use of the Sup email client
 help / color / mirror / Atom feed
* [PATCH]  added command line argument to sup invocation:  "sup email-address" invokes sup in command line
@ 2014-11-08 18:37 Ruthard Baudach
  2014-11-14 10:13 ` [sup] " Gaute Hope
  0 siblings, 1 reply; 6+ messages in thread
From: Ruthard Baudach @ 2014-11-08 18:37 UTC (permalink / raw)
  To: supmua

[-- Attachment #1: Type: text/plain, Size: 1795 bytes --]

---
 History.txt |  5 +++++
 bin/sup     | 15 ++++++++++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/History.txt b/History.txt
index 27ff788..a59ee50 100644
--- a/History.txt
+++ b/History.txt
@@ -1,5 +1,10 @@
 ==
 
+* add email command line argument to sup. sup mail.address@isp.tld
+  is now equal to sup --compose mail.address@isp.tld
+
+==
+
 * You can now unsubscribe from mailinglists using an url, if you have
   a goto-hook setup (Timon Vonk).
 
diff --git a/bin/sup b/bin/sup
index 6757312..fba3ea6 100755
--- a/bin/sup
+++ b/bin/sup
@@ -34,7 +34,11 @@ $opts = Trollop::options do
 Sup is a curses-based email client.
 
 Usage:
-  sup [options]
+  sup [options] [to-address]
+
+Arguments:
+             to-address:  Compose message to this recipient upon startup
+                          --compose overrides an address passed as argument
 
 Options are:
 EOS
@@ -46,8 +50,17 @@ EOS
   opt :subject, "When composing, use this subject", :type => String, :short => "j"
 end
 
+## Trollop does no command argument parsing, only option parsing.
+# After Trollop parsing, ARGV contains only the +rest+ of the command line,
+# thus the arguments to our program
+## compose message if we have an email address as first command line argument
+#  I do not use RMail to check the validity of the address, as RMail tends to throw
+#  exceptions I'm too lazy to handle. Ruthard Baudach
+$opts[:compose] = ARGV[0] if ARGV[0] =~ /.+@.+\..{2,}/ and not $opts[:compose]
+  
 Trollop::die :subject, "requires --compose" if $opts[:subject] && !$opts[:compose]
 
+
 Redwood::HookManager.register "startup", <<EOS
 Executes at startup
 No variables.
-- 
2.1.3

-- 

Please encrypt and sign emails.
My PGP-Id: AC5AC6C2

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-11-16 11:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-08 18:37 [PATCH] added command line argument to sup invocation: "sup email-address" invokes sup in command line Ruthard Baudach
2014-11-14 10:13 ` [sup] " Gaute Hope
2014-11-14 21:48   ` Ruthard Baudach
2014-11-16 11:17     ` Gaute Hope
2014-11-15  9:57   ` Ruthard Baudach
2014-11-16 11:25     ` Gaute Hope

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox