* [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
* Re: [sup] [PATCH] added command line argument to sup invocation: "sup email-address" invokes sup in command line
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 ` Gaute Hope
2014-11-14 21:48 ` Ruthard Baudach
2014-11-15 9:57 ` Ruthard Baudach
0 siblings, 2 replies; 6+ messages in thread
From: Gaute Hope @ 2014-11-14 10:13 UTC (permalink / raw)
To: supmua, Ruthard Baudach
got a few comments below [btw: it is better to send a completely new
patch with your changes squashed together than to send incremental
changes to the first patch].
- gaute
Excerpts from Ruthard Baudach's message of November 8, 2014 19:37:
> ---
> 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
> +
> +==
^^ drop '==' here, move the history line below previous news, the '==' is
there because I don't know the date/version number of the next release
yet, so it is a placeholder for the next header.
> +
> * 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
^^ i think it would be better to fail if --compose is specified in addition to
an unnamed argument, what happens if i want to specify many addresses?
what do you think?
>
> 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
add '.', why different levels of '#' ? try to stay at approx 80
char width.
> +# 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
^^ drop these lines - i guess we dont need super-strict validation since
this is user input and not stuff received from somebody else.
> +$opts[:compose] = ARGV[0] if ARGV[0] =~ /.+@.+\..{2,}/ and not $opts[:compose]
> +
> Trollop::die :subject, "requires --compose" if $opts[:subject] && !$opts[:compose]
>
> +
^^ drop extra newline
> Redwood::HookManager.register "startup", <<EOS
> Executes at startup
> No variables.
> --
> 2.1.3
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [sup] [PATCH] added command line argument to sup invocation: "sup email-address" invokes sup in command line
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
1 sibling, 1 reply; 6+ messages in thread
From: Ruthard Baudach @ 2014-11-14 21:48 UTC (permalink / raw)
To: Gaute Hope; +Cc: supmua
[-- Attachment #1: Type: text/plain, Size: 2202 bytes --]
>== Auszüge aus der Nachricht von Gaute Hope vom 2014-11-14 11:13:
> got a few comments below [btw: it is better to send a completely new
> patch with your changes squashed together than to send incremental
> changes to the first patch].
I still have to master this "stupid content tracker". Hope to figure it
out.
> > 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
>
> ^^ i think it would be better to fail if --compose is specified in addition to
> an unnamed argument, what happens if i want to specify many addresses?
> what do you think?
I had trouble to figure out how --compose works. As far as I found out
by now it accepts exact ONE argument, which might be a string containing
a list of well formatted email addresses. No checks are done,
sup --compose "This is all a terrible nonsense"
will happily compose an email with a "To: This is all a terrible
nonsense" header.
Thus I think I could just add the arguments to compose and ARGV.join(' '),
check this combined address list with RMail::Address.parse, inform the
user if the mails are not well formed, and pass the list happily to the
existing code
This way the option --compose and any command arguments would work
seamlessly together.
What do you think?
> >
> > +## 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
>
> add '.'
sorry, yes
> , why different levels of '#' ?
a habit I took from lisp and bash, somehow feels like structuring
comments and code
> try to stay at approx 80
> char width.
I do like Python, my vim is set to tw=80 for all of my work.
Well, usually.
Yours, Ruthard
--
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
* Re: [sup] [PATCH] added command line argument to sup invocation: "sup email-address" invokes sup in command line
2014-11-14 21:48 ` Ruthard Baudach
@ 2014-11-16 11:17 ` Gaute Hope
0 siblings, 0 replies; 6+ messages in thread
From: Gaute Hope @ 2014-11-16 11:17 UTC (permalink / raw)
To: Ruthard Baudach; +Cc: supmua
Excerpts from Ruthard Baudach's message of November 14, 2014 22:48:
>>== Auszüge aus der Nachricht von Gaute Hope vom 2014-11-14 11:13:
>> got a few comments below [btw: it is better to send a completely new
>> patch with your changes squashed together than to send incremental
>> changes to the first patch].
>
> I still have to master this "stupid content tracker". Hope to figure it
> out.
>
>> > 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
>>
>> ^^ i think it would be better to fail if --compose is specified in addition to
>> an unnamed argument, what happens if i want to specify many addresses?
>> what do you think?
>
> I had trouble to figure out how --compose works. As far as I found out
> by now it accepts exact ONE argument, which might be a string containing
> a list of well formatted email addresses. No checks are done,
>
> sup --compose "This is all a terrible nonsense"
>
> will happily compose an email with a "To: This is all a terrible
> nonsense" header.
>
> Thus I think I could just add the arguments to compose and ARGV.join(' '),
> check this combined address list with RMail::Address.parse, inform the
> user if the mails are not well formed, and pass the list happily to the
> existing code
>
> This way the option --compose and any command arguments would work
> seamlessly together.
>
> What do you think?
>
>> >
>> > +## 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
>>
>> add '.'
> sorry, yes
>> , why different levels of '#' ?
> a habit I took from lisp and bash, somehow feels like structuring
> comments and code
>> try to stay at approx 80
>> char width.
> I do like Python, my vim is set to tw=80 for all of my work.
> Well, usually.
All sounds good.
- gaute
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [sup] [PATCH] added command line argument to sup invocation: "sup email-address" invokes sup in command line
2014-11-14 10:13 ` [sup] " Gaute Hope
2014-11-14 21:48 ` Ruthard Baudach
@ 2014-11-15 9:57 ` Ruthard Baudach
2014-11-16 11:25 ` Gaute Hope
1 sibling, 1 reply; 6+ messages in thread
From: Ruthard Baudach @ 2014-11-15 9:57 UTC (permalink / raw)
To: Gaute Hope; +Cc: supmua
[-- Attachment #1.1: Type: text/plain, Size: 789 bytes --]
>== Auszüge aus der Nachricht von Gaute Hope vom 2014-11-14 11:13:
> got a few comments below [btw: it is better to send a completely new
> patch with your changes squashed together than to send incremental
> changes to the first patch].
I really found no way to do this, as far as I understood it, it's
intentional that format-patch preserves all commits by means of
incremental patches. I just re-cloned the repository.
The patch attached will add addresses provided by --compose and as
arguments. No checks on validity of the provided addresses are done, as
the --compose option did not check the validity up to now and users
are able to view and correct typing mistakes in compose mode.
Regards, Ruthard
--
Please encrypt and sign emails.
My PGP-Id: AC5AC6C2
[-- Attachment #1.2: 0001-email-command-argument-support.patch --]
[-- Type: application/x-msdos-program, Size: 1694 bytes --]
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [sup] [PATCH] added command line argument to sup invocation: "sup email-address" invokes sup in command line
2014-11-15 9:57 ` Ruthard Baudach
@ 2014-11-16 11:25 ` Gaute Hope
0 siblings, 0 replies; 6+ messages in thread
From: Gaute Hope @ 2014-11-16 11:25 UTC (permalink / raw)
To: Ruthard Baudach; +Cc: supmua
Excerpts from Ruthard Baudach's message of November 15, 2014 10:57:
>>== Auszüge aus der Nachricht von Gaute Hope vom 2014-11-14 11:13:
>> got a few comments below [btw: it is better to send a completely new
>> patch with your changes squashed together than to send incremental
>> changes to the first patch].
> I really found no way to do this, as far as I understood it, it's
> intentional that format-patch preserves all commits by means of
> incremental patches. I just re-cloned the repository.
Here's my workflow in this case (very quickly jotted down):
- say you have a 'compose-dev' branch with you changes based off
'develop' with incremental commits (the orignal patch, the
refinements, etc)
- (first make sure 'develop' is up-to-date: git checkout develop; git
pull)
- when you're ready to send a pull request or send the patches upstream:
- make a new branch off compose-dev: $ git checkout compose-dev; git checkout -b
compose-dev-polished
- now we need to cleanup this one, also 'develop' might have changed
since you started. so we need to rebase. use rebase -i
(--interactive) against 'develop': git rebase -i develop
- now git will start putting the commits on top of 'develop' as it is
now, there migth be conflicts, resolve them. in the commit message
file that pops up as part of the rebase you can choose to re-order,
re-phrase and squash commits. I typically squash minor refinements,
while if you make two distinct changes they should remain as two
separate commits (you will then send both upstream).
If you need to make further refinements later you can reset your dev
branch to the polished one and keep working there: (git checkout
compose-dev; git reset --hard compose-dev-polished <- careful, will
delete any changes done in compose-dev).
- gaute
^ 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